@opentiny/vue-renderless 3.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/action-sheet/index.js +28 -0
- package/action-sheet/vue.js +29 -0
- package/alert/index.js +23 -0
- package/alert/vue.js +37 -0
- package/autocomplete/index.js +175 -0
- package/autocomplete/vue.js +171 -0
- package/avatar/index.js +29 -0
- package/avatar/vue.js +24 -0
- package/badge/index.js +16 -0
- package/badge/vue.js +30 -0
- package/breadcrumb/vue.js +4 -0
- package/breadcrumb-item/vue.js +24 -0
- package/bulletin-board/index.js +21 -0
- package/bulletin-board/vue.js +36 -0
- package/button/index.js +19 -0
- package/button/vue.js +43 -0
- package/button-group/index.js +25 -0
- package/button-group/vue.js +51 -0
- package/calendar/index.js +279 -0
- package/calendar/vue.js +124 -0
- package/card-template/index.js +39 -0
- package/card-template/vue.js +34 -0
- package/carousel/index.js +206 -0
- package/carousel/vue.js +222 -0
- package/carousel-item/index.js +93 -0
- package/carousel-item/vue.js +57 -0
- package/cascader/index.js +511 -0
- package/cascader/vue.js +342 -0
- package/cascader-menu/index.js +41 -0
- package/cascader-menu/vue.js +36 -0
- package/cascader-node/index.js +63 -0
- package/cascader-node/vue.js +62 -0
- package/cascader-panel/index.js +359 -0
- package/cascader-panel/node.js +199 -0
- package/cascader-panel/store.js +80 -0
- package/cascader-panel/vue.js +217 -0
- package/checkbox/index.js +145 -0
- package/checkbox/vue.js +139 -0
- package/checkbox-button/index.js +102 -0
- package/checkbox-button/vue.js +150 -0
- package/checkbox-group/index.js +12 -0
- package/checkbox-group/vue.js +33 -0
- package/col/index.js +132 -0
- package/col/vue.js +34 -0
- package/collapse/index.js +45 -0
- package/collapse/vue.js +35 -0
- package/collapse-item/index.js +38 -0
- package/collapse-item/vue.js +48 -0
- package/common/array.js +120 -0
- package/common/bigInt.js +352 -0
- package/common/browser.js +69 -0
- package/common/dataset/index.js +135 -0
- package/common/date.js +352 -0
- package/common/decimal.js +203 -0
- package/common/deps/ResizeObserver.js +474 -0
- package/common/deps/after-leave.js +25 -0
- package/common/deps/clickoutside.js +61 -0
- package/common/deps/date-util.js +262 -0
- package/common/deps/date.js +308 -0
- package/common/deps/debounce.js +4 -0
- package/common/deps/dom.js +190 -0
- package/common/deps/fullscreen/apis.js +157 -0
- package/common/deps/fullscreen/screenfull.js +106 -0
- package/common/deps/letter-only.js +15 -0
- package/common/deps/memorize.js +149 -0
- package/common/deps/number-only.js +16 -0
- package/common/deps/popper.js +713 -0
- package/common/deps/popup-manager.js +179 -0
- package/common/deps/repeat-click.js +24 -0
- package/common/deps/requestAnimationFrame.js +25 -0
- package/common/deps/resize-event.js +29 -0
- package/common/deps/scroll-into-view.js +29 -0
- package/common/deps/scrollbar-width.js +25 -0
- package/common/deps/throttle.js +34 -0
- package/common/deps/touch.js +33 -0
- package/common/deps/tree-model/node.js +586 -0
- package/common/deps/tree-model/tree-store.js +377 -0
- package/common/deps/tree-model/util.js +14 -0
- package/common/deps/upload-ajax.js +71 -0
- package/common/deps/vue-emitter.js +30 -0
- package/common/deps/vue-popper.js +291 -0
- package/common/deps/vue-popup.js +211 -0
- package/common/event.js +17 -0
- package/common/index.js +288 -0
- package/common/object.js +228 -0
- package/common/runtime.js +52 -0
- package/common/string.js +446 -0
- package/common/type.js +65 -0
- package/common/validate/index.js +6 -0
- package/common/validate/messages.js +68 -0
- package/common/validate/rules/enum.js +8 -0
- package/common/validate/rules/index.js +14 -0
- package/common/validate/rules/pattern.js +16 -0
- package/common/validate/rules/range.js +62 -0
- package/common/validate/rules/required.js +13 -0
- package/common/validate/rules/type.js +110 -0
- package/common/validate/rules/whitespace.js +6 -0
- package/common/validate/schema.js +323 -0
- package/common/validate/util.js +198 -0
- package/common/validate/validations/array.js +25 -0
- package/common/validate/validations/date.js +35 -0
- package/common/validate/validations/enum.js +24 -0
- package/common/validate/validations/float.js +24 -0
- package/common/validate/validations/index.js +42 -0
- package/common/validate/validations/integer.js +24 -0
- package/common/validate/validations/method.js +23 -0
- package/common/validate/validations/number.js +27 -0
- package/common/validate/validations/pattern.js +23 -0
- package/common/validate/validations/required.js +15 -0
- package/common/validate/validations/string.js +29 -0
- package/common/validate/validations/type.js +25 -0
- package/common/xss.js +325 -0
- package/container/index.js +110 -0
- package/container/vue.js +63 -0
- package/credit-card/index.js +107 -0
- package/credit-card/vue.js +117 -0
- package/credit-card-form/index.js +143 -0
- package/credit-card-form/vue.js +150 -0
- package/crop/index.js +297 -0
- package/crop/vue.js +191 -0
- package/date-panel/index.js +584 -0
- package/date-panel/vue.js +319 -0
- package/date-picker/index.js +301 -0
- package/date-picker/vue.js +169 -0
- package/date-range/index.js +463 -0
- package/date-range/vue.js +297 -0
- package/date-table/index.js +457 -0
- package/date-table/vue.js +151 -0
- package/detail-page/index.js +135 -0
- package/detail-page/vue.js +145 -0
- package/dialog-box/index.js +268 -0
- package/dialog-box/vue.js +226 -0
- package/drop-times/index.js +23 -0
- package/drop-times/vue.js +28 -0
- package/dropdown/index.js +259 -0
- package/dropdown/vue.js +107 -0
- package/dropdown-item/index.js +155 -0
- package/dropdown-item/vue.js +124 -0
- package/dropdown-menu/index.js +148 -0
- package/dropdown-menu/vue.js +44 -0
- package/exception/index.js +13 -0
- package/exception/vue.js +25 -0
- package/fall-menu/index.js +121 -0
- package/fall-menu/vue.js +90 -0
- package/file-upload/index.js +1940 -0
- package/file-upload/vue.js +458 -0
- package/floatbar/index.js +10 -0
- package/floatbar/vue.js +17 -0
- package/form/index.js +186 -0
- package/form/vue.js +69 -0
- package/form-item/index.js +364 -0
- package/form-item/vue.js +210 -0
- package/fullscreen/index.js +138 -0
- package/fullscreen/vue.js +77 -0
- package/grid/core/index.js +3 -0
- package/grid/core/interceptor.js +38 -0
- package/grid/core/storeMap.js +19 -0
- package/grid/plugins/export.js +169 -0
- package/grid/plugins/exportExcel.js +749 -0
- package/grid/plugins/header.js +58 -0
- package/grid/plugins/resize.js +82 -0
- package/grid/static/array/arrayEach.js +12 -0
- package/grid/static/array/arrayIndexOf.js +11 -0
- package/grid/static/array/eachTree.js +32 -0
- package/grid/static/array/every.js +2 -0
- package/grid/static/array/filterTree.js +16 -0
- package/grid/static/array/find.js +3 -0
- package/grid/static/array/findTree.js +46 -0
- package/grid/static/array/helperCreateIterateHandle.js +59 -0
- package/grid/static/array/helperCreateTreeFunc.js +18 -0
- package/grid/static/array/includes.js +5 -0
- package/grid/static/array/lastArrayEach.js +6 -0
- package/grid/static/array/map.js +23 -0
- package/grid/static/array/mapTree.js +33 -0
- package/grid/static/array/slice.js +10 -0
- package/grid/static/array/sortBy.js +69 -0
- package/grid/static/array/sum.js +28 -0
- package/grid/static/array/toArray.js +7 -0
- package/grid/static/array/toTreeArray.js +24 -0
- package/grid/static/base/clear.js +44 -0
- package/grid/static/base/clone.js +18 -0
- package/grid/static/base/destructuring.js +18 -0
- package/grid/static/base/each.js +9 -0
- package/grid/static/base/eqNull.js +6 -0
- package/grid/static/base/findIndexOf.js +10 -0
- package/grid/static/base/get.js +42 -0
- package/grid/static/base/has.js +60 -0
- package/grid/static/base/hasOwnProp.js +4 -0
- package/grid/static/base/helperCreateGetObjects.js +26 -0
- package/grid/static/base/helperCreateInInObjectString.js +7 -0
- package/grid/static/base/helperCreateInTypeof.js +6 -0
- package/grid/static/base/helperCreateIndexOf.js +21 -0
- package/grid/static/base/helperCreateiterateIndexOf.js +21 -0
- package/grid/static/base/helperDefaultCompare.js +4 -0
- package/grid/static/base/helperDeleteProperty.js +8 -0
- package/grid/static/base/helperEqualCompare.js +60 -0
- package/grid/static/base/helperGetHGSKeys.js +4 -0
- package/grid/static/base/indexOf.js +3 -0
- package/grid/static/base/isArray.js +3 -0
- package/grid/static/base/isBoolean.js +4 -0
- package/grid/static/base/isDate.js +3 -0
- package/grid/static/base/isEmpty.js +8 -0
- package/grid/static/base/isEqual.js +11 -0
- package/grid/static/base/isFunction.js +4 -0
- package/grid/static/base/isNaN.js +5 -0
- package/grid/static/base/isNull.js +4 -0
- package/grid/static/base/isNumber.js +4 -0
- package/grid/static/base/isObject.js +5 -0
- package/grid/static/base/isPlainObject.js +2 -0
- package/grid/static/base/isRegExp.js +3 -0
- package/grid/static/base/isSet.js +5 -0
- package/grid/static/base/isString.js +4 -0
- package/grid/static/base/isUndefined.js +4 -0
- package/grid/static/base/keys.js +3 -0
- package/grid/static/base/lastEach.js +9 -0
- package/grid/static/base/remove.js +44 -0
- package/grid/static/base/set.js +43 -0
- package/grid/static/base/toJSONString.js +4 -0
- package/grid/static/base/toStringJSON.js +13 -0
- package/grid/static/base/uniqueId.js +5 -0
- package/grid/static/browse/browse.js +54 -0
- package/grid/static/function/property.js +7 -0
- package/grid/static/function/throttle.js +43 -0
- package/grid/static/index.js +55 -0
- package/grid/static/number/helperCreateToNumber.js +12 -0
- package/grid/static/number/toNumber.js +3 -0
- package/grid/static/object/assign.js +41 -0
- package/grid/static/object/extend.js +3 -0
- package/grid/static/object/lastObjectEach.js +8 -0
- package/grid/static/object/objectEach.js +11 -0
- package/grid/static/object/objectMap.js +20 -0
- package/grid/static/object/values.js +9 -0
- package/grid/static/static/staticDocument.js +4 -0
- package/grid/static/static/staticHGKeyRE.js +2 -0
- package/grid/static/static/staticParseInt.js +2 -0
- package/grid/static/static/staticStrUndefined.js +2 -0
- package/grid/static/static/staticWindow.js +4 -0
- package/grid/static/string/template.js +12 -0
- package/grid/static/string/toString.js +12 -0
- package/grid/utils/column.js +72 -0
- package/grid/utils/common.js +155 -0
- package/grid/utils/dom.js +213 -0
- package/grid/utils/event.js +40 -0
- package/grid/utils/index.js +5 -0
- package/image/index.js +187 -0
- package/image/vue.js +142 -0
- package/image-viewer/index.js +469 -0
- package/image-viewer/vue.js +243 -0
- package/input/index.js +319 -0
- package/input/vue.js +319 -0
- package/ip-address/index.js +370 -0
- package/ip-address/vue.js +185 -0
- package/layout/vue.js +4 -0
- package/link/index.js +10 -0
- package/link/vue.js +26 -0
- package/link-menu/index.js +146 -0
- package/link-menu/vue.js +138 -0
- package/list/index.js +13 -0
- package/list/vue.js +17 -0
- package/loading/index.js +29 -0
- package/loading/vue.js +28 -0
- package/milestone/index.js +92 -0
- package/milestone/vue.js +31 -0
- package/mini-picker/index.js +227 -0
- package/mini-picker/vue.js +142 -0
- package/modal/index.js +866 -0
- package/modal/vue.js +130 -0
- package/month-range/index.js +169 -0
- package/month-range/vue.js +104 -0
- package/month-table/index.js +232 -0
- package/month-table/vue.js +72 -0
- package/nav-menu/index.js +457 -0
- package/nav-menu/vue.js +187 -0
- package/notify/index.js +91 -0
- package/notify/vue.js +67 -0
- package/numeric/index.js +419 -0
- package/numeric/vue.js +218 -0
- package/option/index.js +79 -0
- package/option/vue.js +219 -0
- package/option-group/index.js +18 -0
- package/option-group/vue.js +37 -0
- package/package.json +179 -0
- package/pager-item/index.js +122 -0
- package/pager-item/vue.js +52 -0
- package/panel/index.js +30 -0
- package/panel/vue.js +26 -0
- package/picker/index.js +1039 -0
- package/picker/timezone.js +974 -0
- package/picker/vue.js +415 -0
- package/picker-column/index.js +261 -0
- package/picker-column/vue.js +163 -0
- package/pop-upload/index.js +324 -0
- package/pop-upload/vue.js +292 -0
- package/popeditor/index.js +884 -0
- package/popeditor/vue.js +368 -0
- package/popover/index.js +203 -0
- package/popover/vue.js +174 -0
- package/popup/index.js +139 -0
- package/popup/vue.js +129 -0
- package/progress/index.js +174 -0
- package/progress/vue.js +118 -0
- package/pull-refresh/index.js +104 -0
- package/pull-refresh/vue.js +64 -0
- package/radio/index.js +83 -0
- package/radio/vue.js +99 -0
- package/radio-button/index.js +58 -0
- package/radio-button/vue.js +70 -0
- package/radio-group/index.js +51 -0
- package/radio-group/vue.js +34 -0
- package/rate/index.js +254 -0
- package/rate/vue.js +158 -0
- package/row/index.js +19 -0
- package/row/vue.js +24 -0
- package/scroll-text/index.js +24 -0
- package/scroll-text/vue.js +31 -0
- package/scrollbar/index.js +127 -0
- package/scrollbar/vue-bar.js +49 -0
- package/scrollbar/vue.js +43 -0
- package/search/index.js +110 -0
- package/search/vue.js +110 -0
- package/select/index.js +1766 -0
- package/select/vue.js +693 -0
- package/select-dropdown/index.js +23 -0
- package/select-dropdown/vue.js +122 -0
- package/slide-bar/index.js +94 -0
- package/slide-bar/vue.js +58 -0
- package/slider/index.js +434 -0
- package/slider/vue.js +172 -0
- package/split/index.js +122 -0
- package/split/vue.js +131 -0
- package/steps/vue.js +4 -0
- package/switch/index.js +45 -0
- package/switch/vue.js +62 -0
- package/tab-bar/index.js +51 -0
- package/tab-bar/vue.js +16 -0
- package/tab-dropdown/index.js +11 -0
- package/tab-dropdown/vue.js +17 -0
- package/tab-item/index.js +37 -0
- package/tab-item/vue.js +49 -0
- package/tab-nav/index.js +247 -0
- package/tab-nav/vue.js +106 -0
- package/tabbar/index.js +32 -0
- package/tabbar/vue.js +54 -0
- package/tabbar-item/index.js +55 -0
- package/tabbar-item/vue.js +53 -0
- package/table/index.js +111 -0
- package/table/vue.js +66 -0
- package/tabs/index.js +174 -0
- package/tabs/vue.js +141 -0
- package/tag/index.js +14 -0
- package/tag/vue.js +13 -0
- package/tall-storage/index.js +161 -0
- package/tall-storage/vue-storage-box.js +25 -0
- package/tall-storage/vue.js +38 -0
- package/text-popup/index.js +75 -0
- package/text-popup/vue.js +64 -0
- package/time/index.js +121 -0
- package/time/vue.js +124 -0
- package/time-line/index.js +60 -0
- package/time-line/vue.js +49 -0
- package/time-panel/index.js +189 -0
- package/time-panel/scrollIntoView.js +23 -0
- package/time-panel/vue.js +110 -0
- package/time-range/index.js +199 -0
- package/time-range/vue.js +129 -0
- package/time-spinner/index.js +175 -0
- package/time-spinner/vue.js +122 -0
- package/toggle-menu/index.js +104 -0
- package/toggle-menu/vue.js +74 -0
- package/tooltip/index.js +171 -0
- package/tooltip/vue.js +133 -0
- package/top-box/index.js +81 -0
- package/top-box/vue.js +77 -0
- package/transfer/index.js +296 -0
- package/transfer/vue.js +138 -0
- package/transfer-panel/index.js +364 -0
- package/transfer-panel/vue.js +258 -0
- package/tree/index.js +642 -0
- package/tree/vue.js +268 -0
- package/tree-menu/index.js +124 -0
- package/tree-menu/vue.js +60 -0
- package/tree-node/index.js +271 -0
- package/tree-node/vue.js +211 -0
- package/upload/index.js +324 -0
- package/upload/vue.js +93 -0
- package/upload-dragger/index.js +50 -0
- package/upload-dragger/vue.js +27 -0
- package/upload-list/index.js +55 -0
- package/upload-list/vue.js +48 -0
- package/user-contact/index.js +13 -0
- package/user-contact/vue.js +20 -0
- package/user-head/index.js +71 -0
- package/user-head/vue.js +47 -0
- package/wizard/index.js +123 -0
- package/wizard/vue.js +45 -0
- package/year-table/index.js +40 -0
- package/year-table/vue.js +23 -0
package/input/index.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { isSame } from '@opentiny/vue-renderless/common/type';
|
|
2
|
+
var HIDDEN_STYLE = "\nheight:0 !important;visibility:hidden !important;overflow:hidden !important;\nposition:absolute !important;z-index:-1000 !important;top:0 !important;right:0 !important\n";
|
|
3
|
+
var CONTEXT_STYLE = ['width', 'line-height', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', 'border-width', 'box-sizing', 'letter-spacing', 'font-family', 'font-weight', 'font-size', 'text-rendering', 'text-transform', 'text-indent'];
|
|
4
|
+
var STYLE = {
|
|
5
|
+
BoxSizing: 'box-sizing',
|
|
6
|
+
BorderBox: 'border-box',
|
|
7
|
+
ContentBox: 'content-box',
|
|
8
|
+
PaddingTop: 'padding-top',
|
|
9
|
+
PaddingBottom: 'padding-bottom',
|
|
10
|
+
BorderTopWidth: 'border-top-width',
|
|
11
|
+
BorderBottomWidth: 'border-bottom-width'
|
|
12
|
+
};
|
|
13
|
+
var isServer = typeof window === 'undefined';
|
|
14
|
+
var isKorean = function isKorean(text) {
|
|
15
|
+
return /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
|
|
16
|
+
};
|
|
17
|
+
export var showBox = function showBox(state) {
|
|
18
|
+
return function () {
|
|
19
|
+
if (state.inputDisabled) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
state.boxVisibility = true;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export var calculateNodeStyling = function calculateNodeStyling() {
|
|
26
|
+
return function (targetElement) {
|
|
27
|
+
var style = window.getComputedStyle(targetElement);
|
|
28
|
+
var boxSizing = style.getPropertyValue(STYLE.BoxSizing);
|
|
29
|
+
var paddingSize = parseFloat(style.getPropertyValue(STYLE.PaddingBottom)) + parseFloat(style.getPropertyValue(STYLE.PaddingTop));
|
|
30
|
+
var borderSize = parseFloat(style.getPropertyValue(STYLE.BorderBottomWidth)) + parseFloat(style.getPropertyValue(STYLE.BorderTopWidth));
|
|
31
|
+
var contextStyle = CONTEXT_STYLE.map(function (name) {
|
|
32
|
+
return "".concat(name, ":").concat(style.getPropertyValue(name));
|
|
33
|
+
}).join(';');
|
|
34
|
+
return {
|
|
35
|
+
contextStyle: contextStyle,
|
|
36
|
+
paddingSize: paddingSize,
|
|
37
|
+
borderSize: borderSize,
|
|
38
|
+
boxSizing: boxSizing
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export var calcTextareaHeight = function calcTextareaHeight(_ref) {
|
|
43
|
+
var api = _ref.api,
|
|
44
|
+
hiddenTextarea = _ref.hiddenTextarea,
|
|
45
|
+
props = _ref.props;
|
|
46
|
+
return function (targetElement) {
|
|
47
|
+
var minRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
48
|
+
var maxRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
49
|
+
if (!hiddenTextarea) {
|
|
50
|
+
hiddenTextarea = document.createElement('textarea');
|
|
51
|
+
document.body.appendChild(hiddenTextarea);
|
|
52
|
+
}
|
|
53
|
+
var _api$calculateNodeSty = api.calculateNodeStyling(targetElement),
|
|
54
|
+
paddingSize = _api$calculateNodeSty.paddingSize,
|
|
55
|
+
borderSize = _api$calculateNodeSty.borderSize,
|
|
56
|
+
boxSizing = _api$calculateNodeSty.boxSizing,
|
|
57
|
+
contextStyle = _api$calculateNodeSty.contextStyle;
|
|
58
|
+
hiddenTextarea.setAttribute('style', "".concat(contextStyle, ";").concat(HIDDEN_STYLE));
|
|
59
|
+
hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
|
|
60
|
+
var height = hiddenTextarea.scrollHeight;
|
|
61
|
+
var textareaStyle = {};
|
|
62
|
+
if (boxSizing === STYLE.BorderBox) {
|
|
63
|
+
height = height + borderSize * 2 + paddingSize;
|
|
64
|
+
} else if (boxSizing === STYLE.ContentBox) {
|
|
65
|
+
height = height - paddingSize;
|
|
66
|
+
}
|
|
67
|
+
hiddenTextarea.value = '';
|
|
68
|
+
var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
|
69
|
+
if (minRows !== null) {
|
|
70
|
+
var minHeight = singleRowHeight * minRows;
|
|
71
|
+
if (boxSizing === STYLE.BorderBox) {
|
|
72
|
+
minHeight = minHeight + paddingSize + borderSize;
|
|
73
|
+
}
|
|
74
|
+
if (props.size) {
|
|
75
|
+
minHeight = props.size == 'mini' ? minHeight * 0.67 : props.size == 'small' ? minHeight : minHeight * 1.17;
|
|
76
|
+
}
|
|
77
|
+
if (props.height) {
|
|
78
|
+
minHeight = props.height;
|
|
79
|
+
}
|
|
80
|
+
height = Math.max(minHeight, height);
|
|
81
|
+
textareaStyle.minHeight = "".concat(minHeight, "px");
|
|
82
|
+
}
|
|
83
|
+
if (maxRows !== null) {
|
|
84
|
+
var maxHeight = singleRowHeight * maxRows;
|
|
85
|
+
if (boxSizing === STYLE.BorderBox) {
|
|
86
|
+
maxHeight += borderSize + paddingSize;
|
|
87
|
+
}
|
|
88
|
+
height = Math.min(maxHeight, height);
|
|
89
|
+
}
|
|
90
|
+
textareaStyle.height = "".concat(height, "px");
|
|
91
|
+
hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea);
|
|
92
|
+
hiddenTextarea = null;
|
|
93
|
+
return textareaStyle;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export var getInput = function getInput(refs) {
|
|
97
|
+
return function () {
|
|
98
|
+
return refs.input || refs.textarea;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export var blur = function blur(api) {
|
|
102
|
+
return function () {
|
|
103
|
+
return api.getInput().blur();
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export var focus = function focus(api) {
|
|
107
|
+
return function () {
|
|
108
|
+
return api.getInput().focus();
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export var select = function select(api) {
|
|
112
|
+
return function () {
|
|
113
|
+
return api.getInput().select();
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export var handleBlur = function handleBlur(_ref2) {
|
|
117
|
+
var api = _ref2.api,
|
|
118
|
+
componentName = _ref2.componentName,
|
|
119
|
+
eventName = _ref2.eventName,
|
|
120
|
+
emit = _ref2.emit,
|
|
121
|
+
props = _ref2.props,
|
|
122
|
+
state = _ref2.state;
|
|
123
|
+
return function (event) {
|
|
124
|
+
state.focused = false;
|
|
125
|
+
emit('blur', event);
|
|
126
|
+
api.isMemoryStorage.value = false;
|
|
127
|
+
if (props.validateEvent) {
|
|
128
|
+
api.dispatch(componentName, eventName, [props.modelValue]);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
export var handleFocus = function handleFocus(_ref3) {
|
|
133
|
+
var api = _ref3.api,
|
|
134
|
+
emit = _ref3.emit,
|
|
135
|
+
state = _ref3.state;
|
|
136
|
+
return function (event) {
|
|
137
|
+
state.focused = true;
|
|
138
|
+
emit('focus', event);
|
|
139
|
+
api.searchMemory(event.target.value);
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
export var handleInput = function handleInput(_ref4) {
|
|
143
|
+
var api = _ref4.api,
|
|
144
|
+
emit = _ref4.emit,
|
|
145
|
+
nextTick = _ref4.nextTick,
|
|
146
|
+
state = _ref4.state;
|
|
147
|
+
return function (event) {
|
|
148
|
+
if (state.isComposing) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (event.target.value === state.nativeInputValue) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
emit('update:modelValue', event.target.value);
|
|
155
|
+
emit('input', event);
|
|
156
|
+
api.searchMemory(event.target.value);
|
|
157
|
+
nextTick(api.setNativeInputValue);
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
export var handleChange = function handleChange(emit) {
|
|
161
|
+
return function (event) {
|
|
162
|
+
return emit('change', event.target.value);
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export var resizeTextarea = function resizeTextarea(_ref5) {
|
|
166
|
+
var api = _ref5.api,
|
|
167
|
+
parent = _ref5.parent,
|
|
168
|
+
refs = _ref5.refs,
|
|
169
|
+
state = _ref5.state;
|
|
170
|
+
return function () {
|
|
171
|
+
if (isServer) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
var autosize = parent.autosize,
|
|
175
|
+
type = parent.type;
|
|
176
|
+
if (type !== 'textarea') {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (!autosize) {
|
|
180
|
+
state.textareaCalcStyle = {
|
|
181
|
+
minHeight: api.calcTextareaHeight(refs.textarea).minHeight
|
|
182
|
+
};
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
var minRows = autosize.minRows;
|
|
186
|
+
var maxRows = autosize.maxRows;
|
|
187
|
+
state.textareaCalcStyle = api.calcTextareaHeight(refs.textarea, minRows, maxRows);
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
export var setNativeInputValue = function setNativeInputValue(_ref6) {
|
|
191
|
+
var api = _ref6.api,
|
|
192
|
+
state = _ref6.state;
|
|
193
|
+
return function () {
|
|
194
|
+
var input = api.getInput();
|
|
195
|
+
if (!input) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (isSame(input.value, state.nativeInputValue)) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
input.value = state.nativeInputValue;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
export var handleCompositionStart = function handleCompositionStart(state) {
|
|
205
|
+
return function () {
|
|
206
|
+
return state.isComposing = true;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
export var handleCompositionUpdate = function handleCompositionUpdate(state) {
|
|
210
|
+
return function (event) {
|
|
211
|
+
var text = event.target.value;
|
|
212
|
+
var lastCharacter = text[text.length - 1] || '';
|
|
213
|
+
state.isComposing = !isKorean(lastCharacter);
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
export var handleCompositionEnd = function handleCompositionEnd(_ref7) {
|
|
217
|
+
var api = _ref7.api,
|
|
218
|
+
state = _ref7.state;
|
|
219
|
+
return function (event) {
|
|
220
|
+
if (state.isComposing) {
|
|
221
|
+
state.isComposing = false;
|
|
222
|
+
api.handleInput(event);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
export var calcIconOffset = function calcIconOffset(_ref8) {
|
|
227
|
+
var CLASS_PREFIX = _ref8.CLASS_PREFIX,
|
|
228
|
+
parent = _ref8.parent;
|
|
229
|
+
return function (place) {
|
|
230
|
+
var elList = [].slice.call(parent.$el.querySelectorAll(".".concat(CLASS_PREFIX.Input).concat(place)) || []);
|
|
231
|
+
if (!elList.length) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
var el = null;
|
|
235
|
+
for (var i = 0, len = elList.length; i < len; i++) {
|
|
236
|
+
if (elList[i].parentNode === parent.$el) {
|
|
237
|
+
el = elList[i];
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (!el) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
var pendantMap = {
|
|
245
|
+
suffix: 'append',
|
|
246
|
+
prefix: 'prepend'
|
|
247
|
+
};
|
|
248
|
+
var pendant = pendantMap[place];
|
|
249
|
+
if (parent.$slots[pendant]) {
|
|
250
|
+
var dom = parent.$el.querySelector(".".concat(CLASS_PREFIX.InputGroup).concat(pendant));
|
|
251
|
+
var transform;
|
|
252
|
+
if (place === 'suffix') {
|
|
253
|
+
transform = "translateX(-".concat(dom.offsetWidth, "px)");
|
|
254
|
+
} else if (place === 'prefix') {
|
|
255
|
+
transform = "translate(".concat(dom.offsetWidth, "px, -50%)");
|
|
256
|
+
}
|
|
257
|
+
el.style.transform = transform;
|
|
258
|
+
} else {
|
|
259
|
+
el.removeAttribute('style');
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
export var updateIconOffset = function updateIconOffset(api) {
|
|
264
|
+
return function () {
|
|
265
|
+
api.calcIconOffset('prefix');
|
|
266
|
+
api.calcIconOffset('suffix');
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
export var clear = function clear(emit) {
|
|
270
|
+
return function () {
|
|
271
|
+
emit('update:modelValue', '');
|
|
272
|
+
emit('change', '');
|
|
273
|
+
emit('clear');
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
export var handlePasswordVisible = function handlePasswordVisible(_ref9) {
|
|
277
|
+
var api = _ref9.api,
|
|
278
|
+
nextTick = _ref9.nextTick,
|
|
279
|
+
state = _ref9.state;
|
|
280
|
+
return function () {
|
|
281
|
+
state.passwordVisible = !state.passwordVisible;
|
|
282
|
+
nextTick(api.focus);
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
export var getSuffixVisible = function getSuffixVisible(_ref10) {
|
|
286
|
+
var parent = _ref10.parent,
|
|
287
|
+
props = _ref10.props,
|
|
288
|
+
state = _ref10.state;
|
|
289
|
+
return function () {
|
|
290
|
+
return parent.$slots.suffix || props.suffixIcon || state.showClear || props.showPassword || state.isWordLimitVisible || state.validateState && state.needStatusIcon;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
export var textLength = function textLength(value) {
|
|
294
|
+
if (typeof value === 'number') {
|
|
295
|
+
return String(value).length;
|
|
296
|
+
}
|
|
297
|
+
return (value || '').length;
|
|
298
|
+
};
|
|
299
|
+
export var watchFormSelect = function watchFormSelect(_ref11) {
|
|
300
|
+
var emit = _ref11.emit,
|
|
301
|
+
props = _ref11.props,
|
|
302
|
+
state = _ref11.state;
|
|
303
|
+
return function (value) {
|
|
304
|
+
if (props.isSelect) {
|
|
305
|
+
emit('update:modelValue', value);
|
|
306
|
+
emit('change', value);
|
|
307
|
+
var filterData = props.selectMenu.length && props.selectMenu.filter(function (item) {
|
|
308
|
+
return item.id === value;
|
|
309
|
+
}).shift();
|
|
310
|
+
state.checkedLable = filterData ? filterData.label : '';
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
export var hasSelection = function hasSelection(api) {
|
|
315
|
+
return function () {
|
|
316
|
+
var input = api.getInput();
|
|
317
|
+
return input && input.selectionStart !== input.selectionEnd;
|
|
318
|
+
};
|
|
319
|
+
};
|
package/input/vue.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
import { blur, showBox, watchFormSelect, clear, focus, select, getInput, textLength, handleBlur, handleFocus, handleInput, handleChange, calcIconOffset, resizeTextarea, getSuffixVisible, updateIconOffset, calcTextareaHeight, setNativeInputValue, calculateNodeStyling, handleCompositionEnd, handlePasswordVisible, handleCompositionStart, handleCompositionUpdate, hasSelection } from './index';
|
|
5
|
+
import useStorageBox from '@opentiny/vue-renderless/tall-storage/vue-storage-box';
|
|
6
|
+
export var api = ['blur', 'showBox', 'clear', 'focus', 'state', 'select', 'getInput', 'handleBlur', 'handleInput', 'handleFocus', 'handleChange', 'calcIconOffset', 'resizeTextarea', 'getSuffixVisible', 'updateIconOffset', 'calcTextareaHeight', 'setNativeInputValue', 'calculateNodeStyling', 'handleCompositionEnd', 'handlePasswordVisible', 'handleCompositionStart', 'handleCompositionUpdate', 'addMemory', 'searchMemory', 'selectedMemory', 'storageData', 'isMemoryStorage', 'hasSelection'];
|
|
7
|
+
var initState = function initState(_ref) {
|
|
8
|
+
var reactive = _ref.reactive,
|
|
9
|
+
computed = _ref.computed,
|
|
10
|
+
mode = _ref.mode,
|
|
11
|
+
props = _ref.props,
|
|
12
|
+
parent = _ref.parent,
|
|
13
|
+
constants = _ref.constants;
|
|
14
|
+
var state = reactive({
|
|
15
|
+
mode: mode,
|
|
16
|
+
focused: false,
|
|
17
|
+
hovering: false,
|
|
18
|
+
isComposing: false,
|
|
19
|
+
passwordVisible: false,
|
|
20
|
+
boxVisibility: false,
|
|
21
|
+
textareaCalcStyle: {},
|
|
22
|
+
checkedLable: '',
|
|
23
|
+
sheetvalue: props.modelValue,
|
|
24
|
+
inputSize: computed(function () {
|
|
25
|
+
return props.size || state.formItemSize;
|
|
26
|
+
}),
|
|
27
|
+
showClear: computed(function () {
|
|
28
|
+
return props.clearable && !state.inputDisabled && !props.readonly && state.nativeInputValue && (state.focused || state.hovering);
|
|
29
|
+
}),
|
|
30
|
+
upperLimit: computed(function () {
|
|
31
|
+
return parent.$attrs.maxlength;
|
|
32
|
+
}),
|
|
33
|
+
textLength: computed(function () {
|
|
34
|
+
return textLength(props.modelValue);
|
|
35
|
+
}),
|
|
36
|
+
inputExceed: computed(function () {
|
|
37
|
+
return state.isWordLimitVisible && state.textLength > state.upperLimit;
|
|
38
|
+
}),
|
|
39
|
+
formItemSize: computed(function () {
|
|
40
|
+
return (parent.formItem || {}).formItemSize;
|
|
41
|
+
}),
|
|
42
|
+
validateIcon: computed(function () {
|
|
43
|
+
return constants.VALIDATE_ICON[state.validateState];
|
|
44
|
+
}),
|
|
45
|
+
showWordLimit: computed(function () {
|
|
46
|
+
return props.showWordLimit && parent.$attrs.maxlength;
|
|
47
|
+
}),
|
|
48
|
+
inputDisabled: computed(function () {
|
|
49
|
+
return props.disabled || (parent.tinyForm || {}).disabled;
|
|
50
|
+
}),
|
|
51
|
+
validateState: computed(function () {
|
|
52
|
+
return parent.formItem ? parent.formItem.validateState : '';
|
|
53
|
+
}),
|
|
54
|
+
textareaStyle: computed(function () {
|
|
55
|
+
return _objectSpread(_objectSpread({}, state.textareaCalcStyle), {}, {
|
|
56
|
+
resize: props.resize
|
|
57
|
+
});
|
|
58
|
+
}),
|
|
59
|
+
needStatusIcon: computed(function () {
|
|
60
|
+
return parent.tinyForm ? parent.tinyForm.statusIcon : false;
|
|
61
|
+
}),
|
|
62
|
+
showPwdVisible: computed(function () {
|
|
63
|
+
return props.showPassword && !state.inputDisabled && !props.readonly && (!!state.nativeInputValue || state.focused);
|
|
64
|
+
}),
|
|
65
|
+
nativeInputValue: computed(function () {
|
|
66
|
+
return props.modelValue === null || props.modelValue === undefined ? '' : String(props.modelValue);
|
|
67
|
+
}),
|
|
68
|
+
isWordLimitVisible: computed(function () {
|
|
69
|
+
return (props.showWordLimit && parent.$attrs.maxlength || props.counter) && (parent.type === 'text' || parent.type === 'textarea') && !state.inputDisabled && !props.readonly && !props.showPassword;
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
return state;
|
|
73
|
+
};
|
|
74
|
+
var initApi = function initApi(_ref2) {
|
|
75
|
+
var api = _ref2.api,
|
|
76
|
+
state = _ref2.state,
|
|
77
|
+
dispatch = _ref2.dispatch,
|
|
78
|
+
broadcast = _ref2.broadcast,
|
|
79
|
+
emit = _ref2.emit,
|
|
80
|
+
refs = _ref2.refs,
|
|
81
|
+
props = _ref2.props,
|
|
82
|
+
CLASS_PREFIX = _ref2.CLASS_PREFIX,
|
|
83
|
+
parent = _ref2.parent;
|
|
84
|
+
Object.assign(api, {
|
|
85
|
+
state: state,
|
|
86
|
+
dispatch: dispatch,
|
|
87
|
+
broadcast: broadcast,
|
|
88
|
+
showBox: showBox(state),
|
|
89
|
+
clear: clear(emit),
|
|
90
|
+
getInput: getInput(refs),
|
|
91
|
+
handleChange: handleChange(emit),
|
|
92
|
+
watchFormSelect: watchFormSelect({
|
|
93
|
+
emit: emit,
|
|
94
|
+
props: props,
|
|
95
|
+
state: state
|
|
96
|
+
}),
|
|
97
|
+
calcIconOffset: calcIconOffset({
|
|
98
|
+
CLASS_PREFIX: CLASS_PREFIX,
|
|
99
|
+
parent: parent
|
|
100
|
+
}),
|
|
101
|
+
getSuffixVisible: getSuffixVisible({
|
|
102
|
+
parent: parent,
|
|
103
|
+
props: props,
|
|
104
|
+
state: state
|
|
105
|
+
}),
|
|
106
|
+
calculateNodeStyling: calculateNodeStyling(),
|
|
107
|
+
handleCompositionStart: handleCompositionStart(state),
|
|
108
|
+
handleCompositionUpdate: handleCompositionUpdate(state)
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
var mergeApi = function mergeApi(_ref3) {
|
|
112
|
+
var storages = _ref3.storages,
|
|
113
|
+
api = _ref3.api,
|
|
114
|
+
componentName = _ref3.componentName,
|
|
115
|
+
props = _ref3.props,
|
|
116
|
+
emit = _ref3.emit,
|
|
117
|
+
eventName = _ref3.eventName,
|
|
118
|
+
nextTick = _ref3.nextTick,
|
|
119
|
+
parent = _ref3.parent,
|
|
120
|
+
state = _ref3.state,
|
|
121
|
+
refs = _ref3.refs;
|
|
122
|
+
var storageData = storages.storageData,
|
|
123
|
+
isMemoryStorage = storages.isMemoryStorage,
|
|
124
|
+
addMemory = storages.addMemory,
|
|
125
|
+
searchMemory = storages.searchMemory,
|
|
126
|
+
selectedMemory = storages.selectedMemory;
|
|
127
|
+
return Object.assign(api, {
|
|
128
|
+
addMemory: addMemory,
|
|
129
|
+
storageData: storageData,
|
|
130
|
+
searchMemory: searchMemory,
|
|
131
|
+
selectedMemory: selectedMemory,
|
|
132
|
+
isMemoryStorage: isMemoryStorage,
|
|
133
|
+
blur: blur(api),
|
|
134
|
+
focus: focus(api),
|
|
135
|
+
select: select(api),
|
|
136
|
+
handleBlur: handleBlur({
|
|
137
|
+
api: api,
|
|
138
|
+
componentName: componentName,
|
|
139
|
+
emit: emit,
|
|
140
|
+
eventName: eventName.blur,
|
|
141
|
+
props: props,
|
|
142
|
+
state: state
|
|
143
|
+
}),
|
|
144
|
+
handleFocus: handleFocus({
|
|
145
|
+
api: api,
|
|
146
|
+
emit: emit,
|
|
147
|
+
state: state
|
|
148
|
+
}),
|
|
149
|
+
handleInput: handleInput({
|
|
150
|
+
api: api,
|
|
151
|
+
emit: emit,
|
|
152
|
+
nextTick: nextTick,
|
|
153
|
+
state: state
|
|
154
|
+
}),
|
|
155
|
+
resizeTextarea: resizeTextarea({
|
|
156
|
+
api: api,
|
|
157
|
+
parent: parent,
|
|
158
|
+
refs: refs,
|
|
159
|
+
state: state
|
|
160
|
+
}),
|
|
161
|
+
updateIconOffset: updateIconOffset(api),
|
|
162
|
+
calcTextareaHeight: calcTextareaHeight({
|
|
163
|
+
api: api,
|
|
164
|
+
hiddenTextarea: null,
|
|
165
|
+
props: props
|
|
166
|
+
}),
|
|
167
|
+
setNativeInputValue: setNativeInputValue({
|
|
168
|
+
api: api,
|
|
169
|
+
state: state
|
|
170
|
+
}),
|
|
171
|
+
handleCompositionEnd: handleCompositionEnd({
|
|
172
|
+
api: api,
|
|
173
|
+
state: state
|
|
174
|
+
}),
|
|
175
|
+
handlePasswordVisible: handlePasswordVisible({
|
|
176
|
+
api: api,
|
|
177
|
+
nextTick: nextTick,
|
|
178
|
+
state: state
|
|
179
|
+
}),
|
|
180
|
+
hasSelection: hasSelection(api)
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
var initWatch = function initWatch(_ref4) {
|
|
184
|
+
var watch = _ref4.watch,
|
|
185
|
+
state = _ref4.state,
|
|
186
|
+
api = _ref4.api,
|
|
187
|
+
props = _ref4.props,
|
|
188
|
+
nextTick = _ref4.nextTick,
|
|
189
|
+
emit = _ref4.emit,
|
|
190
|
+
componentName = _ref4.componentName,
|
|
191
|
+
eventName = _ref4.eventName;
|
|
192
|
+
watch(function () {
|
|
193
|
+
return props.modelValue;
|
|
194
|
+
}, function (value) {
|
|
195
|
+
if (state.mode === 'mobile') {
|
|
196
|
+
state.sheetvalue = value;
|
|
197
|
+
emit('update:modelValue', value);
|
|
198
|
+
}
|
|
199
|
+
nextTick(api.resizeTextarea);
|
|
200
|
+
if (props.validateEvent) {
|
|
201
|
+
api.dispatch(componentName, eventName.change, [value]);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
watch(function () {
|
|
205
|
+
return props.size;
|
|
206
|
+
}, function () {
|
|
207
|
+
return nextTick(api.resizeTextarea);
|
|
208
|
+
}, {
|
|
209
|
+
immediate: true
|
|
210
|
+
});
|
|
211
|
+
watch(function () {
|
|
212
|
+
return state.nativeInputValue;
|
|
213
|
+
}, function () {
|
|
214
|
+
api.setNativeInputValue();
|
|
215
|
+
});
|
|
216
|
+
watch(function () {
|
|
217
|
+
return props.type;
|
|
218
|
+
}, function () {
|
|
219
|
+
nextTick(function () {
|
|
220
|
+
api.setNativeInputValue();
|
|
221
|
+
api.resizeTextarea();
|
|
222
|
+
api.updateIconOffset();
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
watch(function () {
|
|
226
|
+
return state.sheetvalue;
|
|
227
|
+
}, function (value) {
|
|
228
|
+
return api.watchFormSelect(value);
|
|
229
|
+
}, {
|
|
230
|
+
immediate: true
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
export var renderless = function renderless(props, _ref5, _ref6) {
|
|
234
|
+
var computed = _ref5.computed,
|
|
235
|
+
onMounted = _ref5.onMounted,
|
|
236
|
+
onUpdated = _ref5.onUpdated,
|
|
237
|
+
reactive = _ref5.reactive,
|
|
238
|
+
toRefs = _ref5.toRefs,
|
|
239
|
+
watch = _ref5.watch,
|
|
240
|
+
inject = _ref5.inject;
|
|
241
|
+
var vm = _ref6.vm,
|
|
242
|
+
refs = _ref6.refs,
|
|
243
|
+
parent = _ref6.parent,
|
|
244
|
+
emit = _ref6.emit,
|
|
245
|
+
constants = _ref6.constants,
|
|
246
|
+
nextTick = _ref6.nextTick,
|
|
247
|
+
broadcast = _ref6.broadcast,
|
|
248
|
+
dispatch = _ref6.dispatch,
|
|
249
|
+
mode = _ref6.mode;
|
|
250
|
+
var api = {};
|
|
251
|
+
var componentName = constants.COMPONENT_NAME.FormItem;
|
|
252
|
+
var eventName = {
|
|
253
|
+
change: 'form.change',
|
|
254
|
+
blur: 'form.blur'
|
|
255
|
+
};
|
|
256
|
+
var CLASS_PREFIX = {
|
|
257
|
+
Input: constants.inputMode(mode),
|
|
258
|
+
InputGroup: constants.inputGroupMode(mode)
|
|
259
|
+
};
|
|
260
|
+
var state = initState({
|
|
261
|
+
reactive: reactive,
|
|
262
|
+
computed: computed,
|
|
263
|
+
mode: mode,
|
|
264
|
+
props: props,
|
|
265
|
+
parent: parent,
|
|
266
|
+
constants: constants
|
|
267
|
+
});
|
|
268
|
+
initApi({
|
|
269
|
+
api: api,
|
|
270
|
+
state: state,
|
|
271
|
+
dispatch: dispatch,
|
|
272
|
+
broadcast: broadcast,
|
|
273
|
+
emit: emit,
|
|
274
|
+
refs: refs,
|
|
275
|
+
props: props,
|
|
276
|
+
CLASS_PREFIX: CLASS_PREFIX,
|
|
277
|
+
parent: parent
|
|
278
|
+
});
|
|
279
|
+
var storages = useStorageBox({
|
|
280
|
+
api: api,
|
|
281
|
+
props: props,
|
|
282
|
+
reactive: reactive,
|
|
283
|
+
toRefs: toRefs
|
|
284
|
+
});
|
|
285
|
+
parent.tinyForm = parent.tinyForm || inject('form', null);
|
|
286
|
+
mergeApi({
|
|
287
|
+
api: api,
|
|
288
|
+
storages: storages,
|
|
289
|
+
componentName: componentName,
|
|
290
|
+
emit: emit,
|
|
291
|
+
eventName: eventName,
|
|
292
|
+
props: props,
|
|
293
|
+
state: state,
|
|
294
|
+
nextTick: nextTick,
|
|
295
|
+
parent: parent,
|
|
296
|
+
refs: refs
|
|
297
|
+
});
|
|
298
|
+
initWatch({
|
|
299
|
+
watch: watch,
|
|
300
|
+
state: state,
|
|
301
|
+
api: api,
|
|
302
|
+
props: props,
|
|
303
|
+
nextTick: nextTick,
|
|
304
|
+
emit: emit,
|
|
305
|
+
componentName: componentName,
|
|
306
|
+
eventName: eventName
|
|
307
|
+
});
|
|
308
|
+
onMounted(function () {
|
|
309
|
+
api.setNativeInputValue();
|
|
310
|
+
api.resizeTextarea();
|
|
311
|
+
api.updateIconOffset();
|
|
312
|
+
dispatch('Select', 'input-mounted', vm.$el);
|
|
313
|
+
dispatch('Tooltip', 'tooltip-update', vm.$el);
|
|
314
|
+
});
|
|
315
|
+
onUpdated(function () {
|
|
316
|
+
nextTick(api.updateIconOffset);
|
|
317
|
+
});
|
|
318
|
+
return api;
|
|
319
|
+
};
|