@hi-ui/tree-select 4.0.0-beta.24 → 4.0.0-beta.27
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/lib/cjs/TreeSelect.js +2 -6
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/esm/TreeSelect.js +1 -3
- package/lib/esm/styles/index.scss.js +2 -3
- package/package.json +20 -20
- package/lib/cjs/hooks/use-latest/lib/esm/index.js +0 -64
- package/lib/cjs/hooks/use-merge-refs/lib/esm/index.js +0 -76
- package/lib/cjs/ui/input/lib/esm/Input.js +0 -245
- package/lib/cjs/ui/input/lib/esm/MockInput.js +0 -163
- package/lib/cjs/ui/input/lib/esm/styles/index.scss.js +0 -31
- package/lib/cjs/ui/input/lib/esm/use-input.js +0 -138
- package/lib/cjs/ui/input/lib/esm/utils/index.js +0 -201
- package/lib/cjs/utils/dom-utils/lib/esm/index.js +0 -36
- package/lib/esm/hooks/use-latest/lib/esm/index.js +0 -56
- package/lib/esm/hooks/use-merge-refs/lib/esm/index.js +0 -68
- package/lib/esm/ui/input/lib/esm/Input.js +0 -221
- package/lib/esm/ui/input/lib/esm/MockInput.js +0 -141
- package/lib/esm/ui/input/lib/esm/styles/index.scss.js +0 -26
- package/lib/esm/ui/input/lib/esm/use-input.js +0 -127
- package/lib/esm/ui/input/lib/esm/utils/index.js +0 -185
- package/lib/esm/utils/dom-utils/lib/esm/index.js +0 -29
@@ -1,31 +0,0 @@
|
|
1
|
-
/** @LICENSE
|
2
|
-
* @hi-ui/tree-select
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
|
-
*
|
5
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
-
*
|
7
|
-
* This source code is licensed under the MIT license found in the
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/
|
10
|
-
'use strict';
|
11
|
-
|
12
|
-
Object.defineProperty(exports, '__esModule', {
|
13
|
-
value: true
|
14
|
-
});
|
15
|
-
/** @LICENSE
|
16
|
-
* @hi-ui/input
|
17
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme
|
18
|
-
*
|
19
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
20
|
-
*
|
21
|
-
* This source code is licensed under the MIT license found in the
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
23
|
-
*/
|
24
|
-
|
25
|
-
var css_248z = "@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n.hi-v4-mock-input {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: text;\n background-color: transparent;\n -webkit-tap-highlight-color: transparent;\n position: relative;\n overflow: hidden;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: justify;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n width: 100%;\n height: auto;\n z-index: auto;\n font-size: inherit;\n line-height: inherit;\n color: var(--hi-v4-color-gray-700, #1f2733);\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-mock-input:not(.disabled):hover {\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-mock-input:not(.disabled).focused {\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-mock-input.disabled {\n cursor: not-allowed; }\n.hi-v4-mock-input__suffix, .hi-v4-mock-input__placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-mock-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n width: 16px;\n height: 16px;\n font-size: var(--hi-v4-text-size-md, 0.875rem);\n text-align: center;\n color: var(--hi-v4-color-gray-500, #929aa6);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n visibility: hidden;\n opacity: 0;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1)); }\n.hi-v4-mock-input__clear:hover {\n color: var(--hi-v4-color-static-black, #000); }\n.hi-v4-mock-input__clear.active {\n visibility: visible;\n opacity: 1; }\n.hi-v4-mock-input__suffix {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n color: var(--hi-v4-color-gray-400, #c9ced6);\n font-size: var(--hi-v4-text-size-lg, 1rem);\n padding-left: var(--hi-v4-spacing-4, 8px);\n text-align: center; }\n.hi-v4-mock-input__value {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: inline-block;\n width: auto;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap; }\n.hi-v4-mock-input--size-sm.hi-v4-mock-input {\n height: var(--hi-v4-height-6, 24px);\n font-size: var(--hi-v4-text-size-sm, 0.75rem);\n line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);\n border-radius: var(--hi-v4-border-radius-md, 4px);\n padding: 1px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--size-md.hi-v4-mock-input {\n height: var(--hi-v4-height-8, 32px);\n font-size: var(--hi-v4-text-size-md, 0.875rem);\n line-height: var(--hi-v4-text-lineheight-md, 1.375rem);\n border-radius: var(--hi-v4-border-radius-md, 4px);\n padding: 4px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--size-lg.hi-v4-mock-input {\n height: var(--hi-v4-height-10, 40px);\n font-size: var(--hi-v4-text-size-lg, 1rem);\n line-height: var(--hi-v4-text-lineheight-lg, 1.5rem);\n border-radius: var(--hi-v4-border-radius-md, 4px);\n padding: 7px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input {\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled):hover {\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled).invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled).invalid.hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-line.hi-v4-mock-input:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input {\n width: auto;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n border-color: transparent; }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled):hover {\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled).invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled).invalid.hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-unset.hi-v4-mock-input:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input {\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled):hover {\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled).focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled).invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled).invalid.hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-mock-input--appearance-filled.hi-v4-mock-input:not(.disabled).invalid.focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-mock-input--appearance-line.disabled.hi-v4-mock-input, .hi-v4-mock-input--appearance-unset.disabled.hi-v4-mock-input, .hi-v4-mock-input--appearance-filled.disabled.hi-v4-mock-input {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-mock-input--appearance-line.disabled.hi-v4-mock-input, .hi-v4-mock-input--appearance-filled.disabled.hi-v4-mock-input {\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n@use 'sass:map';\n.hi-v4-input {\n position: relative;\n display: inline-block;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n width: 100%; }\n.hi-v4-input__outer {\n margin: 0;\n padding: 0;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n position: relative;\n height: 100%;\n width: 100%; }\n.hi-v4-input__text {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: none;\n outline: none;\n -webkit-box-shadow: none;\n box-shadow: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n cursor: text;\n background-color: transparent;\n -webkit-tap-highlight-color: transparent;\n -webkit-box-flex: 1;\n -ms-flex: 1 1;\n flex: 1 1;\n display: inline-block;\n box-sizing: border-box;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n width: 100%;\n font-size: inherit;\n line-height: inherit;\n color: var(--hi-v4-color-gray-700, #1f2733); }\n.hi-v4-input__text::-webkit-input-placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text::-moz-placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text::-ms-input-placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text:-ms-input-placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text::placeholder {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__text:disabled {\n cursor: not-allowed; }\n.hi-v4-input__inner {\n position: relative;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n height: auto;\n width: 100%;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: inherit;\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n background-color: var(--hi-v4-color-static-white, #fff);\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n outline: none;\n z-index: auto; }\n.hi-v4-input__inner:not(.hi-v4-input__inner--disabled):hover {\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--focused {\n z-index: calc(var(--hi-v4-zindex-absolute, 1) + 1); }\n.hi-v4-input__clear {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n height: auto;\n text-align: center;\n font-size: var(--hi-v4-text-size-md, 0.875rem);\n color: var(--hi-v4-color-gray-500, #929aa6);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n cursor: pointer;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n visibility: hidden;\n opacity: 0; }\n.hi-v4-input__clear:hover {\n color: var(--hi-v4-color-gray-700, #1f2733); }\n.hi-v4-input__clear.hi-v4-input__clear--active {\n visibility: visible;\n opacity: 1; }\n.hi-v4-input__inner--suffix .hi-v4-input__clear {\n -webkit-margin-end: var(--hi-v4-spacing-2, 4px);\n margin-inline-end: var(--hi-v4-spacing-2, 4px); }\n.hi-v4-input__prefix, .hi-v4-input__suffix {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n color: var(--hi-v4-color-gray-700, #1f2733);\n font-size: inherit;\n text-align: center; }\n.hi-v4-input__prefix {\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input__suffix {\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input__prepend, .hi-v4-input__append {\n position: relative;\n color: var(--hi-v4-color-gray-700, #1f2733);\n background-color: var(--hi-v4-color-gray-50, #f5f7fa);\n -ms-flex-negative: 0;\n flex-shrink: 0;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n font-size: inherit;\n text-align: center;\n padding: 0 calc(var(--hi-v4-spacing-6, 12px) - 1px);\n border: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-static-transparent, transparent);\n white-space: nowrap;\n -webkit-transition-property: all;\n transition-property: all;\n -webkit-transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n transition-duration: var(--hi-v4-motion-duration-normal, 200ms);\n -webkit-transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));\n z-index: var(--hi-v4-zindex-absolute, 1); }\n.hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n margin-right: -1px; }\n.hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n margin-left: -1px; }\n.hi-v4-input--size-sm {\n height: var(--hi-v4-height-6, 24px);\n font-size: var(--hi-v4-text-size-sm, 0.75rem);\n line-height: var(--hi-v4-text-lineheight-sm, 1.25rem); }\n.hi-v4-input--size-sm .hi-v4-input__text {\n padding: 1px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-sm .hi-v4-input__inner,\n .hi-v4-input--size-sm .hi-v4-input__prepend,\n .hi-v4-input--size-sm .hi-v4-input__append {\n border-radius: var(--hi-v4-border-radius-md, 4px); }\n.hi-v4-input--size-sm .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-sm .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--size-md {\n height: var(--hi-v4-height-8, 32px);\n font-size: var(--hi-v4-text-size-md, 0.875rem);\n line-height: var(--hi-v4-text-lineheight-md, 1.375rem); }\n.hi-v4-input--size-md .hi-v4-input__text {\n padding: 4px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-md .hi-v4-input__inner,\n .hi-v4-input--size-md .hi-v4-input__prepend,\n .hi-v4-input--size-md .hi-v4-input__append {\n border-radius: var(--hi-v4-border-radius-md, 4px); }\n.hi-v4-input--size-md .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-md .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--size-lg {\n height: var(--hi-v4-height-10, 40px);\n font-size: var(--hi-v4-text-size-lg, 1rem);\n line-height: var(--hi-v4-text-lineheight-lg, 1.5rem); }\n.hi-v4-input--size-lg .hi-v4-input__text {\n padding: 7px calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--size-lg .hi-v4-input__inner,\n .hi-v4-input--size-lg .hi-v4-input__prepend,\n .hi-v4-input--size-lg .hi-v4-input__append {\n border-radius: var(--hi-v4-border-radius-md, 4px); }\n.hi-v4-input--size-lg .hi-v4-input__prepend {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input--size-lg .hi-v4-input__append {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input--appearance-line .hi-v4-input__inner {\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled):hover {\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid:hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid.hi-v4-input__inner--focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-input--appearance-line .hi-v4-input__prepend,\n .hi-v4-input--appearance-line .hi-v4-input__append {\n border-color: var(--hi-v4-color-gray-300, #dfe2e8); }\n.hi-v4-input--appearance-unset .hi-v4-input__text {\n padding-left: 0;\n padding-right: 0; }\n.hi-v4-input--appearance-unset.hi-v4-input__outer--prepend .hi-v4-input__text,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--prefix .hi-v4-input__text {\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-unset.hi-v4-input__outer--append .hi-v4-input__text,\n .hi-v4-input--appearance-unset .hi-v4-input__inner--suffix .hi-v4-input__text {\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-unset .hi-v4-input__inner {\n border-radius: 0; }\n.hi-v4-input--appearance-filled .hi-v4-input__inner {\n background-color: var(--hi-v4-color-gray-100, #f2f4f7); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled):hover {\n background-color: var(--hi-v4-color-static-white, #fff);\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n box-shadow: 0 0 0 2px var(--hi-v4-color-primary-100, var(--hi-v4-color-brandblue-100, #bde2ff));\n border-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));\n background-color: var(--hi-v4-color-static-white, #fff); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid:hover {\n border-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-filled .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid.hi-v4-input__inner--focused {\n -webkit-box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9));\n box-shadow: 0 0 0 2px var(--hi-v4-color-danger-100, var(--hi-v4-color-red-100, #ffd1c9)); }\n.hi-v4-input--appearance-underline .hi-v4-input__text {\n padding-left: 0;\n padding-right: 0; }\n.hi-v4-input--appearance-underline.hi-v4-input__outer--prepend .hi-v4-input__text,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--prefix .hi-v4-input__text {\n padding-left: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-underline.hi-v4-input__outer--append .hi-v4-input__text,\n .hi-v4-input--appearance-underline .hi-v4-input__inner--suffix .hi-v4-input__text {\n padding-right: calc(var(--hi-v4-spacing-6, 12px) - 1px); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner {\n border-radius: 0; }\n.hi-v4-input--appearance-underline .hi-v4-input__inner::after {\n content: '';\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n display: block;\n position: absolute;\n bottom: 0;\n left: -1px;\n right: -1px;\n border-bottom: 1px solid var(--hi-v4-color-gray-300, #dfe2e8);\n -webkit-transition: all 0.3s;\n transition: all 0.3s; }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.hi-v4-input__inner--disabled):hover::after {\n border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--focused::after {\n border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa)); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid::after {\n border-bottom-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-underline .hi-v4-input__inner:not(.hi-v4-input__inner--disabled).hi-v4-input__inner--invalid.hover::after {\n border-bottom-color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959)); }\n.hi-v4-input--appearance-line .hi-v4-input__inner.hi-v4-input__inner--disabled, .hi-v4-input--appearance-filled .hi-v4-input__inner.hi-v4-input__inner--disabled {\n color: var(--hi-v4-color-gray-400, #c9ced6);\n background-color: var(--hi-v4-color-gray-200, #ebedf0); }\n.hi-v4-input--appearance-line .hi-v4-input__inner.hi-v4-input__inner--disabled .hi-v4-input__text, .hi-v4-input--appearance-filled .hi-v4-input__inner.hi-v4-input__inner--disabled .hi-v4-input__text {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input--appearance-unset .hi-v4-input__inner.hi-v4-input__inner--disabled, .hi-v4-input--appearance-underline .hi-v4-input__inner.hi-v4-input__inner--disabled {\n color: var(--hi-v4-color-gray-400, #c9ced6);\n background-color: transparent; }\n.hi-v4-input--appearance-unset .hi-v4-input__inner.hi-v4-input__inner--disabled .hi-v4-input__text, .hi-v4-input--appearance-underline .hi-v4-input__inner.hi-v4-input__inner--disabled .hi-v4-input__text {\n color: var(--hi-v4-color-gray-400, #c9ced6); }\n.hi-v4-input__outer--prepend .hi-v4-input__inner {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend {\n border: none;\n padding: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend .hi-v4-mock-input {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--prepend-unset .hi-v4-input__prepend .hi-v4-button {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--append .hi-v4-input__inner {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append {\n border: none;\n padding: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append .hi-v4-mock-input {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n.hi-v4-input__outer--append-unset .hi-v4-input__append .hi-v4-button {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0; }\n";
|
26
|
-
|
27
|
-
var __styleInject__ = require('style-inject/dist/style-inject.es.js')["default"];
|
28
|
-
|
29
|
-
__styleInject__(css_248z);
|
30
|
-
|
31
|
-
exports["default"] = css_248z;
|
@@ -1,138 +0,0 @@
|
|
1
|
-
/** @LICENSE
|
2
|
-
* @hi-ui/tree-select
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
|
-
*
|
5
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
-
*
|
7
|
-
* This source code is licensed under the MIT license found in the
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/
|
10
|
-
'use strict';
|
11
|
-
|
12
|
-
Object.defineProperty(exports, '__esModule', {
|
13
|
-
value: true
|
14
|
-
});
|
15
|
-
|
16
|
-
var React = require('react');
|
17
|
-
|
18
|
-
var useUncontrolledState = require('@hi-ui/use-uncontrolled-state');
|
19
|
-
|
20
|
-
var index$1 = require('../../../../hooks/use-latest/lib/esm/index.js');
|
21
|
-
|
22
|
-
var index$2 = require('../../../../utils/dom-utils/lib/esm/index.js');
|
23
|
-
|
24
|
-
var index = require('./utils/index.js');
|
25
|
-
/** @LICENSE
|
26
|
-
* @hi-ui/input
|
27
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme
|
28
|
-
*
|
29
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
30
|
-
*
|
31
|
-
* This source code is licensed under the MIT license found in the
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
33
|
-
*/
|
34
|
-
|
35
|
-
|
36
|
-
var useInput = function useInput(_ref) {
|
37
|
-
var name = _ref.name,
|
38
|
-
_ref$autoFocus = _ref.autoFocus,
|
39
|
-
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
40
|
-
_ref$disabled = _ref.disabled,
|
41
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
42
|
-
_ref$readOnly = _ref.readOnly,
|
43
|
-
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
44
|
-
maxLength = _ref.maxLength,
|
45
|
-
placeholder = _ref.placeholder,
|
46
|
-
_ref$defaultValue = _ref.defaultValue,
|
47
|
-
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
48
|
-
valueProp = _ref.value,
|
49
|
-
onChange = _ref.onChange,
|
50
|
-
onFocus = _ref.onFocus,
|
51
|
-
onBlur = _ref.onBlur,
|
52
|
-
_ref$trimValueOnBlur = _ref.trimValueOnBlur,
|
53
|
-
trimValueOnBlur = _ref$trimValueOnBlur === void 0 ? false : _ref$trimValueOnBlur,
|
54
|
-
_ref$type = _ref.type,
|
55
|
-
type = _ref$type === void 0 ? 'text' : _ref$type,
|
56
|
-
clearElementRef = _ref.clearElementRef; // Object.is 避免 trimValueOnBlur 和 点击 clearIcon 触发 2 次相同的 onCHange
|
57
|
-
|
58
|
-
var _useUncontrolledState = useUncontrolledState.useUncontrolledState(defaultValue, valueProp, onChange, Object.is),
|
59
|
-
value = _useUncontrolledState[0],
|
60
|
-
tryChangeValue = _useUncontrolledState[1];
|
61
|
-
|
62
|
-
var handleChange = React.useCallback(function (evt, trim) {
|
63
|
-
if (trim === void 0) {
|
64
|
-
trim = false;
|
65
|
-
}
|
66
|
-
|
67
|
-
evt.persist();
|
68
|
-
var nextValue = evt.target.value;
|
69
|
-
var valueTrue = index.pure(nextValue, type); // 防溢出,保证 onChange 拿到的是值是最新的 formatted value
|
70
|
-
|
71
|
-
var value = index.format(nextValue, type);
|
72
|
-
|
73
|
-
if (trim) {
|
74
|
-
valueTrue = valueTrue.trim();
|
75
|
-
value = value.trim();
|
76
|
-
}
|
77
|
-
|
78
|
-
var event = Object.create(evt);
|
79
|
-
event.target = Object.assign(Object.assign({}, evt.target), {
|
80
|
-
value: value
|
81
|
-
});
|
82
|
-
tryChangeValue(valueTrue, event);
|
83
|
-
}, [tryChangeValue, type]);
|
84
|
-
|
85
|
-
var _useState = React.useState(autoFocus),
|
86
|
-
focused = _useState[0],
|
87
|
-
setFocused = _useState[1];
|
88
|
-
|
89
|
-
var handleFocus = index$1.useLatestCallback(function (evt) {
|
90
|
-
setFocused(true);
|
91
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus(evt);
|
92
|
-
});
|
93
|
-
var handleBlur = index$1.useLatestCallback(function (event) {
|
94
|
-
var relatedTarget = event.relatedTarget; // 拦截 clearIcon 点击清空,阻止其触发 input 失焦
|
95
|
-
|
96
|
-
if (clearElementRef && clearElementRef.current && clearElementRef.current === relatedTarget) {
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
|
100
|
-
setFocused(false); // amount 自动添加小数
|
101
|
-
|
102
|
-
if (type === 'amount') {
|
103
|
-
event.target.value = index.formatAmount(value, true);
|
104
|
-
handleChange(event, trimValueOnBlur);
|
105
|
-
} else if (trimValueOnBlur) {
|
106
|
-
handleChange(event, true);
|
107
|
-
}
|
108
|
-
|
109
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
110
|
-
});
|
111
|
-
var nativeInputProps = React.useMemo(function () {
|
112
|
-
return {
|
113
|
-
name: name,
|
114
|
-
disabled: disabled,
|
115
|
-
readOnly: readOnly,
|
116
|
-
autoFocus: autoFocus,
|
117
|
-
placeholder: placeholder,
|
118
|
-
maxLength: maxLength,
|
119
|
-
'data-focused': index$2.setAttrStatus(focused)
|
120
|
-
};
|
121
|
-
}, [disabled, readOnly, autoFocus, placeholder, maxLength, name, focused]);
|
122
|
-
var getInputProps = React.useCallback(function () {
|
123
|
-
return Object.assign(Object.assign({}, nativeInputProps), {
|
124
|
-
value: index.format(value, type),
|
125
|
-
onChange: handleChange,
|
126
|
-
onFocus: handleFocus,
|
127
|
-
onBlur: handleBlur
|
128
|
-
});
|
129
|
-
}, [value, type, handleChange, handleFocus, handleBlur, nativeInputProps]);
|
130
|
-
return {
|
131
|
-
focused: focused,
|
132
|
-
value: value,
|
133
|
-
tryChangeValue: tryChangeValue,
|
134
|
-
getInputProps: getInputProps
|
135
|
-
};
|
136
|
-
};
|
137
|
-
|
138
|
-
exports.useInput = useInput;
|
@@ -1,201 +0,0 @@
|
|
1
|
-
/** @LICENSE
|
2
|
-
* @hi-ui/tree-select
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
|
-
*
|
5
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
-
*
|
7
|
-
* This source code is licensed under the MIT license found in the
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/
|
10
|
-
'use strict';
|
11
|
-
|
12
|
-
Object.defineProperty(exports, '__esModule', {
|
13
|
-
value: true
|
14
|
-
});
|
15
|
-
/** @LICENSE
|
16
|
-
* @hi-ui/input
|
17
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme
|
18
|
-
*
|
19
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
20
|
-
*
|
21
|
-
* This source code is licensed under the MIT license found in the
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
23
|
-
*/
|
24
|
-
|
25
|
-
/**
|
26
|
-
* 格式化身份证
|
27
|
-
*/
|
28
|
-
|
29
|
-
var formatId = function formatId(val) {
|
30
|
-
val = val.replace(/[^a-zA-Z0-9]/g, '');
|
31
|
-
var len = val.length;
|
32
|
-
|
33
|
-
if (val === '' || len < 7) {
|
34
|
-
return val;
|
35
|
-
}
|
36
|
-
|
37
|
-
if (len < 11) {
|
38
|
-
return val.slice(0, 6) + ' ' + val.slice(6, 10);
|
39
|
-
} else if (len < 15) {
|
40
|
-
return val.slice(0, 6) + ' ' + val.slice(6, 10) + ' ' + val.slice(10, 14);
|
41
|
-
} else {
|
42
|
-
return val.slice(0, 6) + ' ' + val.slice(6, 10) + ' ' + val.slice(10, 14) + ' ' + val.slice(14, 18);
|
43
|
-
}
|
44
|
-
};
|
45
|
-
|
46
|
-
var pureId = function pureId(val) {
|
47
|
-
var tmp = val.replace(/[^\d|.]/g, '');
|
48
|
-
return tmp.slice(0, 18);
|
49
|
-
};
|
50
|
-
/**
|
51
|
-
* 格式化手机号
|
52
|
-
*/
|
53
|
-
|
54
|
-
|
55
|
-
var formatTel = function formatTel(val) {
|
56
|
-
val = val.replace(/\D/g, '');
|
57
|
-
var len = val.length;
|
58
|
-
|
59
|
-
if (val === '' || len < 4) {
|
60
|
-
return val;
|
61
|
-
}
|
62
|
-
|
63
|
-
if (len < 8) {
|
64
|
-
return val.slice(0, 3) + ' ' + val.slice(3, 7);
|
65
|
-
} else {
|
66
|
-
return val.slice(0, 3) + ' ' + val.slice(3, 7) + ' ' + val.slice(7, 11);
|
67
|
-
}
|
68
|
-
};
|
69
|
-
|
70
|
-
var pureTel = function pureTel(val) {
|
71
|
-
var tmp = val.replace(/[^\d|.]/g, '');
|
72
|
-
return tmp.slice(0, 11);
|
73
|
-
};
|
74
|
-
/**
|
75
|
-
* 格式化银行卡号
|
76
|
-
*/
|
77
|
-
|
78
|
-
|
79
|
-
var formatCard = function formatCard(val) {
|
80
|
-
val = val.replace(/\D/g, '');
|
81
|
-
var len = val.length;
|
82
|
-
|
83
|
-
if (val === '' || val.length < 5) {
|
84
|
-
return val;
|
85
|
-
}
|
86
|
-
|
87
|
-
if (len < 9) {
|
88
|
-
return val.slice(0, 4) + ' ' + val.slice(4, 8);
|
89
|
-
} else if (len < 13) {
|
90
|
-
return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12);
|
91
|
-
} else if (len < 17) {
|
92
|
-
return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12) + ' ' + val.slice(12, 16);
|
93
|
-
} else {
|
94
|
-
return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12) + ' ' + val.slice(12, 16) + ' ' + val.slice(16, 19);
|
95
|
-
}
|
96
|
-
};
|
97
|
-
|
98
|
-
var pureCard = function pureCard(val) {
|
99
|
-
var tmp = val.replace(/[^\d|.]/g, '');
|
100
|
-
return tmp.slice(0, 19);
|
101
|
-
};
|
102
|
-
/**
|
103
|
-
* 金额自动生成小数
|
104
|
-
* @param {string} val 需要处理的值
|
105
|
-
*/
|
106
|
-
|
107
|
-
|
108
|
-
var formatAmount = function formatAmount(val, fill) {
|
109
|
-
if (fill === void 0) {
|
110
|
-
fill = false;
|
111
|
-
}
|
112
|
-
|
113
|
-
val = val.replace(/[^\d|.|,]/g, '').replace(/(\.\d*?)(\.|,).*/, function (_, $1) {
|
114
|
-
return $1;
|
115
|
-
});
|
116
|
-
|
117
|
-
if (fill) {
|
118
|
-
if (!val) return val;
|
119
|
-
return val.indexOf('.') > -1 ? val : val + '.00';
|
120
|
-
}
|
121
|
-
|
122
|
-
return val;
|
123
|
-
};
|
124
|
-
|
125
|
-
var pureAmount = function pureAmount(val) {
|
126
|
-
var tmp = val.replace(/[^\d|.]/g, '');
|
127
|
-
return tmp;
|
128
|
-
};
|
129
|
-
|
130
|
-
var formatEmail = function formatEmail(val) {
|
131
|
-
return val.replace(/\W/g, '');
|
132
|
-
};
|
133
|
-
|
134
|
-
var pureEmail = function pureEmail(val) {
|
135
|
-
return val;
|
136
|
-
};
|
137
|
-
/**
|
138
|
-
* 输入规则
|
139
|
-
*/
|
140
|
-
|
141
|
-
|
142
|
-
var format = function format(val, type) {
|
143
|
-
switch (type) {
|
144
|
-
case 'id':
|
145
|
-
return formatId(val);
|
146
|
-
|
147
|
-
case 'tel':
|
148
|
-
return formatTel(val);
|
149
|
-
|
150
|
-
case 'card':
|
151
|
-
return formatCard(val);
|
152
|
-
|
153
|
-
case 'email':
|
154
|
-
return formatEmail(val);
|
155
|
-
|
156
|
-
case 'amount':
|
157
|
-
return formatAmount(val);
|
158
|
-
|
159
|
-
default:
|
160
|
-
return val;
|
161
|
-
}
|
162
|
-
};
|
163
|
-
/**
|
164
|
-
* 净化规则
|
165
|
-
*/
|
166
|
-
|
167
|
-
|
168
|
-
var pure = function pure(val, type) {
|
169
|
-
switch (type) {
|
170
|
-
case 'id':
|
171
|
-
return pureId(val);
|
172
|
-
|
173
|
-
case 'tel':
|
174
|
-
return pureTel(val);
|
175
|
-
|
176
|
-
case 'card':
|
177
|
-
return pureCard(val);
|
178
|
-
|
179
|
-
case 'email':
|
180
|
-
return pureEmail(val);
|
181
|
-
|
182
|
-
case 'amount':
|
183
|
-
return pureAmount(val);
|
184
|
-
|
185
|
-
default:
|
186
|
-
return val;
|
187
|
-
}
|
188
|
-
};
|
189
|
-
|
190
|
-
exports.format = format;
|
191
|
-
exports.formatAmount = formatAmount;
|
192
|
-
exports.formatCard = formatCard;
|
193
|
-
exports.formatEmail = formatEmail;
|
194
|
-
exports.formatId = formatId;
|
195
|
-
exports.formatTel = formatTel;
|
196
|
-
exports.pure = pure;
|
197
|
-
exports.pureAmount = pureAmount;
|
198
|
-
exports.pureCard = pureCard;
|
199
|
-
exports.pureEmail = pureEmail;
|
200
|
-
exports.pureId = pureId;
|
201
|
-
exports.pureTel = pureTel;
|
@@ -1,36 +0,0 @@
|
|
1
|
-
/** @LICENSE
|
2
|
-
* @hi-ui/tree-select
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
|
-
*
|
5
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
-
*
|
7
|
-
* This source code is licensed under the MIT license found in the
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/
|
10
|
-
'use strict';
|
11
|
-
|
12
|
-
Object.defineProperty(exports, '__esModule', {
|
13
|
-
value: true
|
14
|
-
});
|
15
|
-
|
16
|
-
require('@hi-ui/env');
|
17
|
-
/** @LICENSE
|
18
|
-
* @hi-ui/dom-utils
|
19
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/utils/dom-utils#readme
|
20
|
-
*
|
21
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
22
|
-
*
|
23
|
-
* This source code is licensed under the MIT license found in the
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
25
|
-
*/
|
26
|
-
|
27
|
-
/**
|
28
|
-
* 设置 html data 属性,表示状态
|
29
|
-
*/
|
30
|
-
|
31
|
-
|
32
|
-
var setAttrStatus = function setAttrStatus(bool) {
|
33
|
-
return bool ? '' : undefined;
|
34
|
-
};
|
35
|
-
|
36
|
-
exports.setAttrStatus = setAttrStatus;
|
@@ -1,56 +0,0 @@
|
|
1
|
-
/** @LICENSE
|
2
|
-
* @hi-ui/tree-select
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
|
-
*
|
5
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
-
*
|
7
|
-
* This source code is licensed under the MIT license found in the
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/
|
10
|
-
import { useCallback, useRef } from 'react';
|
11
|
-
/** @LICENSE
|
12
|
-
* @hi-ui/use-latest
|
13
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/hooks/use-latest#readme
|
14
|
-
*
|
15
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
16
|
-
*
|
17
|
-
* This source code is licensed under the MIT license found in the
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
19
|
-
*/
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Keep value up-to-date if it changes.
|
23
|
-
*
|
24
|
-
* @param value
|
25
|
-
* @returns
|
26
|
-
*/
|
27
|
-
|
28
|
-
var useLatestRef = function useLatestRef(value) {
|
29
|
-
var ref = useRef(value);
|
30
|
-
ref.current = value;
|
31
|
-
return ref;
|
32
|
-
};
|
33
|
-
/**
|
34
|
-
* Keep callback function up-to-date if it changes.
|
35
|
-
*
|
36
|
-
* @param callback
|
37
|
-
* @returns
|
38
|
-
*/
|
39
|
-
|
40
|
-
|
41
|
-
var useLatestCallback = function useLatestCallback(callback) {
|
42
|
-
var ref = useLatestRef(callback);
|
43
|
-
return useCallback(function () {
|
44
|
-
var _a2;
|
45
|
-
|
46
|
-
var _a;
|
47
|
-
|
48
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
49
|
-
args[_key] = arguments[_key];
|
50
|
-
}
|
51
|
-
|
52
|
-
return (_a = ref.current) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [ref].concat(args));
|
53
|
-
}, []);
|
54
|
-
};
|
55
|
-
|
56
|
-
export { useLatestCallback, useLatestRef };
|
@@ -1,68 +0,0 @@
|
|
1
|
-
/** @LICENSE
|
2
|
-
* @hi-ui/tree-select
|
3
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/ui/tree-select#readme
|
4
|
-
*
|
5
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
6
|
-
*
|
7
|
-
* This source code is licensed under the MIT license found in the
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
9
|
-
*/
|
10
|
-
import { useMemo } from 'react';
|
11
|
-
/** @LICENSE
|
12
|
-
* @hi-ui/use-merge-refs
|
13
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/hooks/use-merge-refs#readme
|
14
|
-
*
|
15
|
-
* Copyright (c) HIUI <mi-hiui@xiaomi.com>.
|
16
|
-
*
|
17
|
-
* This source code is licensed under the MIT license found in the
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
19
|
-
*/
|
20
|
-
|
21
|
-
/**
|
22
|
-
* A hook to merge multiple refs into a single function ref.
|
23
|
-
*
|
24
|
-
* @param refs
|
25
|
-
*/
|
26
|
-
|
27
|
-
var useMergeRefs = function useMergeRefs() {
|
28
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
29
|
-
refs[_key] = arguments[_key];
|
30
|
-
}
|
31
|
-
|
32
|
-
return useMemo(function () {
|
33
|
-
return mergeRefs.apply(void 0, refs);
|
34
|
-
}, refs);
|
35
|
-
};
|
36
|
-
/**
|
37
|
-
* Merges multiple refs into a single function ref.
|
38
|
-
*
|
39
|
-
* @param refs
|
40
|
-
* @returns
|
41
|
-
*/
|
42
|
-
|
43
|
-
|
44
|
-
function mergeRefs() {
|
45
|
-
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
46
|
-
refs[_key2] = arguments[_key2];
|
47
|
-
} // Empty check
|
48
|
-
|
49
|
-
|
50
|
-
if (refs.some(function (ref) {
|
51
|
-
return ref;
|
52
|
-
}) === false) return null;
|
53
|
-
return function (value) {
|
54
|
-
refs.forEach(function (ref) {
|
55
|
-
setRef(ref, value);
|
56
|
-
});
|
57
|
-
};
|
58
|
-
}
|
59
|
-
|
60
|
-
function setRef(ref, value) {
|
61
|
-
if (typeof ref === 'function') {
|
62
|
-
ref(value);
|
63
|
-
} else if (ref) {
|
64
|
-
ref.current = value;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
export { mergeRefs, useMergeRefs };
|