@hi-ui/tree-select 4.0.0-beta.9 → 4.0.2
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 +32 -22
- package/lib/cjs/index.js +1 -2
- package/lib/cjs/styles/index.scss.js +3 -4
- package/lib/esm/TreeSelect.js +27 -15
- package/lib/esm/index.js +1 -2
- package/lib/esm/styles/index.scss.js +4 -6
- package/lib/types/TreeSelect.d.ts +21 -13
- package/lib/types/context.d.ts +2 -6
- package/lib/types/index.d.ts +1 -0
- package/lib/types/types.d.ts +4 -11
- package/package.json +23 -22
- package/lib/cjs/TreeSelect.js.map +0 -1
- package/lib/cjs/hooks/use-latest/lib/esm/index.js +0 -65
- package/lib/cjs/hooks/use-latest/lib/esm/index.js.map +0 -1
- package/lib/cjs/hooks/use-merge-refs/lib/esm/index.js +0 -77
- package/lib/cjs/hooks/use-merge-refs/lib/esm/index.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/styles/index.scss.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/Input.js +0 -243
- package/lib/cjs/ui/input/lib/esm/Input.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/MockInput.js +0 -164
- package/lib/cjs/ui/input/lib/esm/MockInput.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/styles/index.scss.js +0 -32
- package/lib/cjs/ui/input/lib/esm/styles/index.scss.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/use-input.js +0 -139
- package/lib/cjs/ui/input/lib/esm/use-input.js.map +0 -1
- package/lib/cjs/ui/input/lib/esm/utils/index.js +0 -202
- package/lib/cjs/ui/input/lib/esm/utils/index.js.map +0 -1
- package/lib/cjs/utils/dom-utils/lib/esm/index.js +0 -34
- package/lib/cjs/utils/dom-utils/lib/esm/index.js.map +0 -1
- package/lib/esm/TreeSelect.js.map +0 -1
- package/lib/esm/hooks/use-latest/lib/esm/index.js +0 -57
- package/lib/esm/hooks/use-latest/lib/esm/index.js.map +0 -1
- package/lib/esm/hooks/use-merge-refs/lib/esm/index.js +0 -69
- package/lib/esm/hooks/use-merge-refs/lib/esm/index.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/styles/index.scss.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/Input.js +0 -219
- package/lib/esm/ui/input/lib/esm/Input.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/MockInput.js +0 -142
- package/lib/esm/ui/input/lib/esm/MockInput.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/styles/index.scss.js +0 -27
- package/lib/esm/ui/input/lib/esm/styles/index.scss.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/use-input.js +0 -128
- package/lib/esm/ui/input/lib/esm/use-input.js.map +0 -1
- package/lib/esm/ui/input/lib/esm/utils/index.js +0 -186
- package/lib/esm/ui/input/lib/esm/utils/index.js.map +0 -1
- package/lib/esm/utils/dom-utils/lib/esm/index.js +0 -29
- package/lib/esm/utils/dom-utils/lib/esm/index.js.map +0 -1
- package/lib/types/use-tree-select.d.ts +0 -8
@@ -1,32 +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-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, 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-normal, 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-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, 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-sm, 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-normal, 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-normal, 32px);\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n line-height: var(--hi-v4-text-lineheight-normal, 1.375rem);\n border-radius: var(--hi-v4-border-radius-normal, 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-lg, 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-normal, 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-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, 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-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, 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-normal, 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-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, 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-normal, cubic-bezier(0.37, 0.02, 0.34, 1));\n transition-timing-function: var(--hi-v4-motion-bezier-normal, 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-sm, 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-normal, 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-normal, 32px);\n font-size: var(--hi-v4-text-size-normal, 0.875rem);\n line-height: var(--hi-v4-text-lineheight-normal, 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-normal, 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-lg, 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-normal, 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-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__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;
|
32
|
-
//# sourceMappingURL=index.scss.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,139 +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;
|
139
|
-
//# sourceMappingURL=use-input.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"use-input.js","sources":["../../../../../../../input/lib/esm/use-input.js"],"sourcesContent":["/** @LICENSE\n * @hi-ui/input\n * https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme\n *\n * Copyright (c) HIUI <mi-hiui@xiaomi.com>.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { useCallback, useState, useMemo } from 'react';\nimport { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';\nimport { useLatestCallback } from '@hi-ui/use-latest';\nimport { setAttrStatus } from '@hi-ui/dom-utils';\nimport { pure, format, formatAmount } from './utils/index.js';\n\nvar useInput = function useInput(_ref) {\n var name = _ref.name,\n _ref$autoFocus = _ref.autoFocus,\n autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,\n _ref$disabled = _ref.disabled,\n disabled = _ref$disabled === void 0 ? false : _ref$disabled,\n _ref$readOnly = _ref.readOnly,\n readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,\n maxLength = _ref.maxLength,\n placeholder = _ref.placeholder,\n _ref$defaultValue = _ref.defaultValue,\n defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,\n valueProp = _ref.value,\n onChange = _ref.onChange,\n onFocus = _ref.onFocus,\n onBlur = _ref.onBlur,\n _ref$trimValueOnBlur = _ref.trimValueOnBlur,\n trimValueOnBlur = _ref$trimValueOnBlur === void 0 ? false : _ref$trimValueOnBlur,\n _ref$type = _ref.type,\n type = _ref$type === void 0 ? 'text' : _ref$type,\n clearElementRef = _ref.clearElementRef; // Object.is 避免 trimValueOnBlur 和 点击 clearIcon 触发 2 次相同的 onCHange\n\n var _useUncontrolledState = useUncontrolledState(defaultValue, valueProp, onChange, Object.is),\n value = _useUncontrolledState[0],\n tryChangeValue = _useUncontrolledState[1];\n\n var handleChange = useCallback(function (evt, trim) {\n if (trim === void 0) {\n trim = false;\n }\n\n evt.persist();\n var nextValue = evt.target.value;\n var valueTrue = pure(nextValue, type); // 防溢出,保证 onChange 拿到的是值是最新的 formatted value\n\n var value = format(nextValue, type);\n\n if (trim) {\n valueTrue = valueTrue.trim();\n value = value.trim();\n }\n\n var event = Object.create(evt);\n event.target = Object.assign(Object.assign({}, evt.target), {\n value: value\n });\n tryChangeValue(valueTrue, event);\n }, [tryChangeValue, type]);\n\n var _useState = useState(autoFocus),\n focused = _useState[0],\n setFocused = _useState[1];\n\n var handleFocus = useLatestCallback(function (evt) {\n setFocused(true);\n onFocus === null || onFocus === void 0 ? void 0 : onFocus(evt);\n });\n var handleBlur = useLatestCallback(function (event) {\n var relatedTarget = event.relatedTarget; // 拦截 clearIcon 点击清空,阻止其触发 input 失焦\n\n if (clearElementRef && clearElementRef.current && clearElementRef.current === relatedTarget) {\n return;\n }\n\n setFocused(false); // amount 自动添加小数\n\n if (type === 'amount') {\n event.target.value = formatAmount(value, true);\n handleChange(event, trimValueOnBlur);\n } else if (trimValueOnBlur) {\n handleChange(event, true);\n }\n\n onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);\n });\n var nativeInputProps = useMemo(function () {\n return {\n name: name,\n disabled: disabled,\n readOnly: readOnly,\n autoFocus: autoFocus,\n placeholder: placeholder,\n maxLength: maxLength,\n 'data-focused': setAttrStatus(focused)\n };\n }, [disabled, readOnly, autoFocus, placeholder, maxLength, name, focused]);\n var getInputProps = useCallback(function () {\n return Object.assign(Object.assign({}, nativeInputProps), {\n value: format(value, type),\n onChange: handleChange,\n onFocus: handleFocus,\n onBlur: handleBlur\n });\n }, [value, type, handleChange, handleFocus, handleBlur, nativeInputProps]);\n return {\n focused: focused,\n value: value,\n tryChangeValue: tryChangeValue,\n getInputProps: getInputProps\n };\n};\n\nexport { useInput };\n//# sourceMappingURL=use-input.js.map\n"],"names":["useInput","_ref","name","autoFocus","_ref$autoFocus","disabled","_ref$disabled","readOnly","_ref$readOnly","maxLength","placeholder","defaultValue","_ref$defaultValue","valueProp","value","onChange","onFocus","onBlur","trimValueOnBlur","_ref$trimValueOnBlur","type","_ref$type","clearElementRef","useUncontrolledState","Object","is","_useUncontrolledState","tryChangeValue","handleChange","useCallback","evt","trim","nextValue","valueTrue","pure","format","event","target","useState","focused","_useState","setFocused","handleFocus","useLatestCallback","handleBlur","relatedTarget","formatAmount","nativeInputProps","useMemo","setAttrStatus","getInputProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMaA,QAAQ,GAAG,SAAXA,QAAW,CAAAC,IAAA,EAAA;MACtBC,IAAAA,GAAAA,IAAAA,CAAAA;4BACAC;MAAAA,SAAAA,GAAAA,cAAAA,KAAAA,KAAAA,CAAAA,GAAY,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oMi/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;
|
202
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../input/lib/esm/utils/index.js"],"sourcesContent":["/** @LICENSE\n * @hi-ui/input\n * https://github.com/XiaoMi/hiui/tree/master/packages/ui/input#readme\n *\n * Copyright (c) HIUI <mi-hiui@xiaomi.com>.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * 格式化身份证\n */\nvar formatId = function formatId(val) {\n val = val.replace(/[^a-zA-Z0-9]/g, '');\n var len = val.length;\n\n if (val === '' || len < 7) {\n return val;\n }\n\n if (len < 11) {\n return val.slice(0, 6) + ' ' + val.slice(6, 10);\n } else if (len < 15) {\n return val.slice(0, 6) + ' ' + val.slice(6, 10) + ' ' + val.slice(10, 14);\n } else {\n return val.slice(0, 6) + ' ' + val.slice(6, 10) + ' ' + val.slice(10, 14) + ' ' + val.slice(14, 18);\n }\n};\n\nvar pureId = function pureId(val) {\n var tmp = val.replace(/[^\\d|.]/g, '');\n return tmp.slice(0, 18);\n};\n/**\n * 格式化手机号\n */\n\n\nvar formatTel = function formatTel(val) {\n val = val.replace(/\\D/g, '');\n var len = val.length;\n\n if (val === '' || len < 4) {\n return val;\n }\n\n if (len < 8) {\n return val.slice(0, 3) + ' ' + val.slice(3, 7);\n } else {\n return val.slice(0, 3) + ' ' + val.slice(3, 7) + ' ' + val.slice(7, 11);\n }\n};\n\nvar pureTel = function pureTel(val) {\n var tmp = val.replace(/[^\\d|.]/g, '');\n return tmp.slice(0, 11);\n};\n/**\n * 格式化银行卡号\n */\n\n\nvar formatCard = function formatCard(val) {\n val = val.replace(/\\D/g, '');\n var len = val.length;\n\n if (val === '' || val.length < 5) {\n return val;\n }\n\n if (len < 9) {\n return val.slice(0, 4) + ' ' + val.slice(4, 8);\n } else if (len < 13) {\n return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12);\n } else if (len < 17) {\n return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12) + ' ' + val.slice(12, 16);\n } else {\n return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12) + ' ' + val.slice(12, 16) + ' ' + val.slice(16, 19);\n }\n};\n\nvar pureCard = function pureCard(val) {\n var tmp = val.replace(/[^\\d|.]/g, '');\n return tmp.slice(0, 19);\n};\n/**\n * 金额自动生成小数\n * @param {string} val 需要处理的值\n */\n\n\nvar formatAmount = function formatAmount(val, fill) {\n if (fill === void 0) {\n fill = false;\n }\n\n val = val.replace(/[^\\d|.|,]/g, '').replace(/(\\.\\d*?)(\\.|,).*/, function (_, $1) {\n return $1;\n });\n\n if (fill) {\n if (!val) return val;\n return val.indexOf('.') > -1 ? val : val + '.00';\n }\n\n return val;\n};\n\nvar pureAmount = function pureAmount(val) {\n var tmp = val.replace(/[^\\d|.]/g, '');\n return tmp;\n};\n\nvar formatEmail = function formatEmail(val) {\n return val.replace(/\\W/g, '');\n};\n\nvar pureEmail = function pureEmail(val) {\n return val;\n};\n/**\n * 输入规则\n */\n\n\nvar format = function format(val, type) {\n switch (type) {\n case 'id':\n return formatId(val);\n\n case 'tel':\n return formatTel(val);\n\n case 'card':\n return formatCard(val);\n\n case 'email':\n return formatEmail(val);\n\n case 'amount':\n return formatAmount(val);\n\n default:\n return val;\n }\n};\n/**\n * 净化规则\n */\n\n\nvar pure = function pure(val, type) {\n switch (type) {\n case 'id':\n return pureId(val);\n\n case 'tel':\n return pureTel(val);\n\n case 'card':\n return pureCard(val);\n\n case 'email':\n return pureEmail(val);\n\n case 'amount':\n return pureAmount(val);\n\n default:\n return val;\n }\n};\n\nexport { format, formatAmount, formatCard, formatEmail, formatId, formatTel, pure, pureAmount, pureCard, pureEmail, pureId, pureTel };\n//# sourceMappingURL=index.js.map\n"],"names":["formatId","val","len","length","pureId","tmp","formatTel","pureTel","formatCard","pureCard","formatAmount","fill","replace","_","$1","pureAmount","formatEmail","pureEmail","format","type","pure"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;IAGaA,QAAQ,GAAG,SAAXA,QAAW,CAAAC,GAAA,EAAA;AACtBA,EAAAA,GAAG,GAAGA,GAAG,CAAHA,OAAAA,CAAAA,eAAAA,EAANA,EAAMA,CAANA;MACMC,GAAG,GAAGD,GAAG,CAACE;;MAEZF,GAAG,KAAHA,EAAAA,IAAcC,GAAG,GAAG,GAAG;WAClBD;;;MAGLC,GAAG,GAAG,IAAI;WACLD,GAAG,CAAHA,KAAAA,CAAAA,CAAAA,EAAAA,CAAAA,IAAAA,GAAAA,GAAwBA,GAAG,CAAHA,KAAAA,CAAAA,CAAAA,EAAAA,EAAAA;SAC1B,IAAIC,GAAG,GAAP,EAAA,EAAc;WACZD,GAAG,CAAHA,KAAAA,CAAAA,CAAAA,EAAAA,CAAAA,IAAAA,GAAAA,GAAwBA,GAAG,CAAHA,KAAAA,CAAAA,CAAAA,EAAxBA,EAAwBA,CAAxBA,GAAAA,GAAAA,GAAiDA,GAAG,CAAHA,KAAAA,CAAAA,EAAAA,EAAAA,EAAAA;AADnD,GAAA,MAEA;WAEHA,GAAG,CAAHA,KAAAA,CAAAA,CAAAA,EAAAA,CAAAA,IAAAA,GAAAA,GAAwBA,GAAG,C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,GAAA;;SACd;aACIe,WAAW,CAAAf,GAAA;;SACf;aACIS,YAAY,CAAAT,GAAA;;;aAEZA;;;AAIb;;;;;IAGamB,IAAI,GAAG,SAAPA,IAAO,CAAAnB,GAAA,EAAAkB,IAAA,EAAA;UACVA;SACD;aACIf,MAAM,CAAAH,GAAA;;SACV;aACIM,OAAO,CAAAN,GAAA;;SACX;aACIQ,QAAQ,CAAAR,GAAA;;SACZ;aACIgB,SAAS,CAAAhB,GAAA;;SACb;aACIc,UAAU,CAAAd,GAAA;;;aAEVA;;;;;;;;;;;;;;;"}
|
@@ -1,34 +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/dom-utils
|
17
|
-
* https://github.com/XiaoMi/hiui/tree/master/packages/utils/dom-utils#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
|
-
* 设置 html data 属性,表示状态
|
27
|
-
*/
|
28
|
-
|
29
|
-
var setAttrStatus = function setAttrStatus(bool) {
|
30
|
-
return bool ? '' : undefined;
|
31
|
-
};
|
32
|
-
|
33
|
-
exports.setAttrStatus = setAttrStatus;
|
34
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../utils/dom-utils/lib/esm/index.js"],"sourcesContent":["/** @LICENSE\n * @hi-ui/dom-utils\n * https://github.com/XiaoMi/hiui/tree/master/packages/utils/dom-utils#readme\n *\n * Copyright (c) HIUI <mi-hiui@xiaomi.com>.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * 隐藏 dom 样式\n */\nvar hiddenStyle = {\n position: 'absolute',\n border: 0,\n margin: 0,\n opacity: 0,\n overflow: 'hidden'\n};\n/**\n * 模拟事件默认事件处理机制,以此执行传入的事件处理器\n *\n * @param handlers\n * @returns\n * @ref https://developer.mozilla.org/zh-CN/docs/Web/API/Event/preventDefault\n */\n\nfunction mockDefaultHandlers() {\n for (var _len = arguments.length, handlers = new Array(_len), _key = 0; _key < _len; _key++) {\n handlers[_key] = arguments[_key];\n }\n\n return function mockedDefaultHandler(event) {\n handlers.some(function (handler) {\n if (handler) {\n // handler 执行中,可以阻止默认行为,即将 `defaultPrevented` 置为 `true`\n handler(event);\n }\n\n return event.defaultPrevented;\n });\n };\n}\n/**\n * 设置 html data 属性,表示状态\n */\n\n\nvar setAttrStatus = function setAttrStatus(bool) {\n return bool ? '' : undefined;\n};\n/**\n * 设置 html aria 属性\n */\n\n\nvar setAttrAria = function setAttrAria(bool) {\n return bool ? true : undefined;\n};\n/**\n * 阻止事件的行为,包括默认事件和冒泡\n */\n\n\nvar stopEvent = function stopEvent(evt) {\n evt === null || evt === void 0 ? void 0 : evt.preventDefault();\n evt === null || evt === void 0 ? void 0 : evt.stopPropagation();\n};\n\nexport { hiddenStyle, mockDefaultHandlers, setAttrAria, setAttrStatus, stopEvent };\n//# sourceMappingURL=index.js.map\n"],"names":["setAttrStatus","bool","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkCA;;;;IAGaA,aAAa,GAAG,SAAhBA,aAAgB,CAAAC,IAAA,EAAA;SAAqBA,IAAI,GAAA,EAAA,GAAQC;;;"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TreeSelect.js","sources":["../../src/TreeSelect.tsx"],"sourcesContent":[null],"names":["TREE_SELECT_PREFIX","getPrefixCls","DEFAULT_DATA","DEFAULT_FIELD_NAMES","DEFAULT_EXPANDED_IDS","TreeSelect","forwardRef","_a","ref","prefixCls","className","data","dataSource","disabled","fieldNames","defaultExpandAll","expandedIdsProp","expandedIds","defaultExpandedIds","onExpand","defaultValue","valueProp","value","onChange","searchableProp","searchable","searchModeProp","searchMode","onLoadChildren","titleRender","render","filterOption","onSearchProp","onSearch","clearable","invalid","displayRenderProp","displayRender","placeholderProp","placeholder","appearance","rest","i18n","useLocaleContext","isUndef","get","useToggle","menuVisible","menuVisibleAction","getKeyFields","useCallback","node","key","flattedData","useMemo","baseFlattenTree","tree","childrenFieldName","transform","flattedNode","raw","id","title","isLeaf","useUncontrolledState","getDefaultExpandedIds","map","tryChangeExpandedIds","tryChangeValue","onSelect","selectedId","selectedNode","setSelectedItem","off","useState","selectedItem","_b","useAsyncSearch","loading","hasError","dataSourceStrategy","customSearchStrategy","useTreeCustomSearch","filterSearchStrategy","useFilterSearch","enabled","highlightSearchStrategy","useHighlightSearch","useSearchMode","strategies","stateInSearch","state","setStateInSearch","searchValue","keyword","proxyTitleRender","ret","highlight","React","Highlighter","shouldUseSearch","treeProps","ids","prev","mergedData","nextData","concat","uniqBy","cls","cx","Picker","visible","onOpen","on","onClose","callAllFuncs","trigger","MockInput","suffix","UpOutlined","DownOutlined","focused","isArrayNonEmpty","Tree","selectable","__DEV__","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,IAAMA,kBAAkB,GAAGC,YAAY,CAAC,aAAD,CAAvC;AACA,IAAMC,YAAY,GAAG,EAArB;;AAEA,IAAMC,mBAAmB,GAAG,EAA5B;AACA,IAAMC,oBAAoB,GAAG,EAA7B;AAEA;;;;IAGaC,UAAU,gBAAGC,UAAU,CAClC,UACEC,EADF,EAoCEC,GApCF;wB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AAEvE,WAAW,gBAAGmD,mBAAAA,CAACqB,UAADrB,MAAAA,CAAH,gBAAoBA,mBAAAA,CAACsB,YAADtB,MAAAA;AACvCuB,MAAAA,OAAO,EAAE1E;AACTzB,MAAAA,KAAK,EAAEA;AACPC,MAAAA,QAAQ,EAAE6C;AACVzD,MAAAA,IAAI,EAAE6F;;AAENrE,MAAAA,OAAO,EAAEA;AACTK,MAAAA,UAAU,EAAEA;KAZd0D;IAfJA,EA+BGwB,eAAe,CAACrB,SAAS,CAAC1F,IAAX,CAAf+G,gBACCxB,mBAAAA,CAACyB,IAADzB;AACExF,IAAAA,SAAS,EAAKD,SAAL;AACTmH,IAAAA,UAAU;AACVtD,IAAAA,UAAU,EAAEhD;AACZ+C,IAAAA,QAAQ,EAAEA;;;;AAIVzC,IAAAA,cAAc,EAAEA;KACZyE,UATNH,CADDwB,GAYG,IA3CNxB;AAvL8B,CAAA;;AAmVpC,IAAI2B,OAAJ,EAAa;AACXxH,EAAAA,UAAU,CAACyH,WAAXzH,GAAyB,YAAzBA;;;"}
|
@@ -1,57 +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 };
|
57
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../hooks/use-latest/lib/esm/index.js"],"sourcesContent":["/** @LICENSE\n * @hi-ui/use-latest\n * https://github.com/XiaoMi/hiui/tree/master/packages/hooks/use-latest#readme\n *\n * Copyright (c) HIUI <mi-hiui@xiaomi.com>.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { useRef, useCallback } from 'react';\n/**\n * Keep value up-to-date if it changes.\n *\n * @param value\n * @returns\n */\n\nvar useLatestRef = function useLatestRef(value) {\n var ref = useRef(value);\n ref.current = value;\n return ref;\n};\n/**\n * Keep callback function up-to-date if it changes.\n *\n * @param callback\n * @returns\n */\n\n\nvar useLatestCallback = function useLatestCallback(callback) {\n var ref = useLatestRef(callback);\n return useCallback(function () {\n var _a2;\n\n var _a;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return (_a = ref.current) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [ref].concat(args));\n }, []);\n};\n\nexport { useLatestCallback, useLatestRef };\n//# sourceMappingURL=index.js.map\n"],"names":["useLatestRef","value","ref","useRef","useLatestCallback","callback","useCallback","args","_a","current","_a2","call","apply","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;IAMaA,YAAY,GAAG,SAAfA,YAAe,CAAAC,KAAA,EAAA;MACpBC,GAAG,GAAGC,MAAM,CAAAF,KAAA;AAClBC,EAAAA,GAAG,CAAHA,OAAAA,GAAAA,KAAAA;SACOA;;AAGT;;;;;;;;IAMaE,iBAAiB,GAAG,SAApBA,iBAAoB,CAAAC,QAAA,EAAA;MAGzBH,GAAG,GAAGF,YAAY,CAAAK,QAAA;SACjBC,WAAW,CAAC,YAAA;;;;;sCAAIC,IAAAA,GAAAA,IAAAA,KAAAA,CAAAA,IAAAA,GAAAA,IAAAA,GAAAA,GAAAA,IAAAA,GAAAA,MAAAA,IAAAA,IAAAA;AAAAA,MAAAA,IAAAA,CAAAA,IAAAA,CAAAA,GAAAA,SAAAA,CAAAA,IAAAA,CAAAA;;;WAAgB,CAAAC,EAAA,GAAAN,GAAG,CAAHO,OAAA,MAAA,IAAA,IAAAD,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAAE,GAAA,GAAAF,EAAA,EAAAG,IAAA,CAAAC,KAAA,CAAAF,GAAA,EAAA,CAAAR,GAAA,EAAAW,MAAA,CAAiBN,IAAjB,CAAA;AAArB,GAAA,EAAA,EAAA;;;"}
|