@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
|
@@ -0,0 +1,884 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import { find } from '@opentiny/vue-renderless/common/array';
|
|
6
|
+
import { typeOf, isNull } from '@opentiny/vue-renderless/common/type';
|
|
7
|
+
import { getDataset } from '@opentiny/vue-renderless/common/dataset';
|
|
8
|
+
import { isNullOrEmpty } from '@opentiny/vue-renderless/common/string';
|
|
9
|
+
import { isEqual } from '@opentiny/vue-renderless/common/object';
|
|
10
|
+
import { eachTree } from '@opentiny/vue-renderless/grid/static';
|
|
11
|
+
import { on, off } from '@opentiny/vue-renderless/common/deps/dom';
|
|
12
|
+
export var computedGetTitle = function computedGetTitle(_ref) {
|
|
13
|
+
var constants = _ref.constants,
|
|
14
|
+
props = _ref.props,
|
|
15
|
+
t = _ref.t;
|
|
16
|
+
return props.title || t(constants.TITLE);
|
|
17
|
+
};
|
|
18
|
+
export var computedModalWidth = function computedModalWidth(_ref2) {
|
|
19
|
+
var constants = _ref2.constants,
|
|
20
|
+
props = _ref2.props;
|
|
21
|
+
var modalWidth = 0;
|
|
22
|
+
if (props.multi) {
|
|
23
|
+
modalWidth = parseInt(props.width, 10) > constants.MODAL_WIDTH.multi ? "".concat(parseInt(props.width, 10), "px") : "".concat(constants.MODAL_WIDTH.multi, "px");
|
|
24
|
+
} else {
|
|
25
|
+
modalWidth = parseInt(props.width, 10) > constants.MODAL_WIDTH.radio ? "".concat(parseInt(props.width, 10), "px") : "".concat(constants.MODAL_WIDTH.radio, "px");
|
|
26
|
+
}
|
|
27
|
+
return modalWidth;
|
|
28
|
+
};
|
|
29
|
+
export var createSearchForm = function createSearchForm(props) {
|
|
30
|
+
return function (isRest) {
|
|
31
|
+
return props.conditions.reduce(function (acc, item) {
|
|
32
|
+
if (typeof item.field === 'string') {
|
|
33
|
+
if (isRest) {
|
|
34
|
+
acc[item.field] = '';
|
|
35
|
+
} else {
|
|
36
|
+
acc[item.field] = item.defaultValue ? item.defaultValue : '';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return acc;
|
|
40
|
+
}, {});
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export var getColumns = function getColumns(_ref3) {
|
|
44
|
+
var constants = _ref3.constants,
|
|
45
|
+
props = _ref3.props;
|
|
46
|
+
var columns = props.gridOp.columns;
|
|
47
|
+
var selectionCol = find(columns, function (col) {
|
|
48
|
+
return col.type === constants.COLUMNS_TYPE.selection || col.type === constants.COLUMNS_TYPE.radio;
|
|
49
|
+
});
|
|
50
|
+
if (selectionCol) {
|
|
51
|
+
selectionCol.type = props.multi ? constants.COLUMNS_TYPE.selection : constants.COLUMNS_TYPE.radio;
|
|
52
|
+
} else {
|
|
53
|
+
var indexCol = find(columns, function (col) {
|
|
54
|
+
return col.type === constants.COLUMNS_TYPE.index;
|
|
55
|
+
});
|
|
56
|
+
var index = indexCol ? 1 : 0;
|
|
57
|
+
columns.splice(index, 0, {
|
|
58
|
+
type: props.multi ? constants.COLUMNS_TYPE.selection : constants.COLUMNS_TYPE.radio,
|
|
59
|
+
width: columns.length ? constants.COLUMNS_TYPE.width : ''
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return columns;
|
|
63
|
+
};
|
|
64
|
+
export var getDisplay = function getDisplay(_ref4) {
|
|
65
|
+
var constants = _ref4.constants,
|
|
66
|
+
props = _ref4.props,
|
|
67
|
+
state = _ref4.state;
|
|
68
|
+
return function () {
|
|
69
|
+
if (props.popseletor === constants.TYPE_TREE) {
|
|
70
|
+
return state.treeSelectList.map(function (node) {
|
|
71
|
+
return node.value;
|
|
72
|
+
}).join(props.textSplit);
|
|
73
|
+
} else if (props.multi) {
|
|
74
|
+
var displayTxt = [];
|
|
75
|
+
state.selectedValues.forEach(function (val) {
|
|
76
|
+
var item = find(state.selectedDatas, function (data) {
|
|
77
|
+
return val == data[props.valueField];
|
|
78
|
+
});
|
|
79
|
+
if (item) {
|
|
80
|
+
displayTxt.push(item[props.textField]);
|
|
81
|
+
} else {
|
|
82
|
+
displayTxt.push(val);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return displayTxt.join(props.textSplit);
|
|
86
|
+
} else {
|
|
87
|
+
if (isNull(state.selectedDatas)) {
|
|
88
|
+
return '';
|
|
89
|
+
} else {
|
|
90
|
+
return typeOf(state.selectedDatas) === 'object' ? state.selectedDatas[props.textField] : state.selectedDatas;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export var getMultiSelectedData = function getMultiSelectedData(_ref5) {
|
|
96
|
+
var props = _ref5.props,
|
|
97
|
+
state = _ref5.state;
|
|
98
|
+
return function () {
|
|
99
|
+
var values = [];
|
|
100
|
+
state.selectedDatas.forEach(function (item) {
|
|
101
|
+
item[props.valueField] && values.push(item[props.valueField]);
|
|
102
|
+
});
|
|
103
|
+
state.commitValue = Array.isArray(props.modelValue) ? values : values.join(props.valueSplit);
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export var getRadioSelectedData = function getRadioSelectedData(_ref6) {
|
|
107
|
+
var constants = _ref6.constants,
|
|
108
|
+
props = _ref6.props,
|
|
109
|
+
state = _ref6.state,
|
|
110
|
+
vm = _ref6.vm;
|
|
111
|
+
return function () {
|
|
112
|
+
var refs = vm.$refs;
|
|
113
|
+
var table = props.showHistory && state.activeName === 'history' ? refs[constants.GRID_REF.history] : refs[constants.GRID_REF.source];
|
|
114
|
+
var radioRow = table && table.getRadioRow();
|
|
115
|
+
if (radioRow) state.selectedDatas = radioRow;
|
|
116
|
+
state.commitValue = state.selectedDatas ? state.selectedDatas[props.valueField] : '';
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
export var handleClear = function handleClear(_ref7) {
|
|
120
|
+
var constants = _ref7.constants,
|
|
121
|
+
emit = _ref7.emit,
|
|
122
|
+
props = _ref7.props,
|
|
123
|
+
state = _ref7.state;
|
|
124
|
+
return function () {
|
|
125
|
+
if (state.disabled) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
state.display = '';
|
|
129
|
+
state.commitValue = Array.isArray(props.modelValue) ? [] : '';
|
|
130
|
+
state.treeSelectList = [];
|
|
131
|
+
state.selectedDatas = [];
|
|
132
|
+
state.selectedValues = [];
|
|
133
|
+
if (!isEqual(state.commitValue, props.modelValue)) {
|
|
134
|
+
emit('update:modelValue', state.commitValue);
|
|
135
|
+
emit('change', state.commitValue, props.popseletor === constants.TYPE_GRID ? state.treeSelectList : state.selectedDatas);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
export var handleConfirm = function handleConfirm(_ref8) {
|
|
140
|
+
var api = _ref8.api,
|
|
141
|
+
constants = _ref8.constants,
|
|
142
|
+
emit = _ref8.emit,
|
|
143
|
+
props = _ref8.props,
|
|
144
|
+
state = _ref8.state;
|
|
145
|
+
return function (skipBeforeClose) {
|
|
146
|
+
if (skipBeforeClose !== true && typeof props.beforeClose === 'function' && props.beforeClose('confirm') === false) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (props.popseletor === constants.TYPE_GRID) {
|
|
150
|
+
props.multi ? api.getMultiSelectedData({
|
|
151
|
+
props: props,
|
|
152
|
+
state: state
|
|
153
|
+
}) : api.getRadioSelectedData();
|
|
154
|
+
if (!isNull(state.commitValue)) {
|
|
155
|
+
state.display = api.getDisplay({
|
|
156
|
+
props: props,
|
|
157
|
+
state: state
|
|
158
|
+
});
|
|
159
|
+
if (!isEqual(state.commitValue, props.modelValue)) {
|
|
160
|
+
state.display = '';
|
|
161
|
+
emit('update:modelValue', state.commitValue);
|
|
162
|
+
emit('change', state.commitValue, state.selectedDatas);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (props.popseletor === constants.TYPE_TREE) {
|
|
167
|
+
var commitValue = state.treeSelectList.map(function (item) {
|
|
168
|
+
return item.id;
|
|
169
|
+
}).join(props.valueSplit);
|
|
170
|
+
if (!isEqual(commitValue, props.modelValue)) {
|
|
171
|
+
emit('update:modelValue', commitValue);
|
|
172
|
+
emit('change', commitValue, state.treeSelectList);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
state.open = false;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
export var handleReset = function handleReset(_ref9) {
|
|
179
|
+
var api = _ref9.api,
|
|
180
|
+
state = _ref9.state,
|
|
181
|
+
props = _ref9.props;
|
|
182
|
+
return function () {
|
|
183
|
+
state.search = api.createSearchForm(true);
|
|
184
|
+
if (state.filterText) {
|
|
185
|
+
state.filterText = '';
|
|
186
|
+
}
|
|
187
|
+
if (!props.beforeReset || typeof props.beforeReset === 'function' && props.beforeReset(state.conditions) !== false) {
|
|
188
|
+
api.handleSearch();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
export var handleOpen = function handleOpen(_ref10) {
|
|
193
|
+
var api = _ref10.api,
|
|
194
|
+
constants = _ref10.constants,
|
|
195
|
+
props = _ref10.props,
|
|
196
|
+
state = _ref10.state;
|
|
197
|
+
return function (event) {
|
|
198
|
+
if (event.target.tagName === constants.TAG_NAME && state.readonly) {
|
|
199
|
+
api.openDialog({
|
|
200
|
+
api: api,
|
|
201
|
+
props: props,
|
|
202
|
+
state: state
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
export var handleSearch = function handleSearch(_ref11) {
|
|
208
|
+
var api = _ref11.api,
|
|
209
|
+
refs = _ref11.refs,
|
|
210
|
+
constants = _ref11.constants;
|
|
211
|
+
return function () {
|
|
212
|
+
var sourcetable = refs[constants.GRID_REF.source];
|
|
213
|
+
sourcetable && sourcetable.clearRadioRow();
|
|
214
|
+
api.query();
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
var cancelOrClose = function cancelOrClose(_ref12) {
|
|
218
|
+
var props = _ref12.props,
|
|
219
|
+
state = _ref12.state,
|
|
220
|
+
constants = _ref12.constants;
|
|
221
|
+
state.open = false;
|
|
222
|
+
if (props.popseletor === constants.TYPE_TREE) {
|
|
223
|
+
var treeSelectList = state.cacheStore.treeSelectList;
|
|
224
|
+
state.treeSelectList = treeSelectList.slice(0);
|
|
225
|
+
} else {
|
|
226
|
+
if (props.multi) {
|
|
227
|
+
var _state$cacheStore = state.cacheStore,
|
|
228
|
+
selectedDatas = _state$cacheStore.selectedDatas,
|
|
229
|
+
selectedValues = _state$cacheStore.selectedValues;
|
|
230
|
+
state.selectedDatas = selectedDatas.slice(0);
|
|
231
|
+
state.selectedValues = selectedValues.slice(0);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
export var handleCancel = function handleCancel(_ref13) {
|
|
236
|
+
var props = _ref13.props,
|
|
237
|
+
state = _ref13.state,
|
|
238
|
+
constants = _ref13.constants;
|
|
239
|
+
return function () {
|
|
240
|
+
if (typeof props.beforeClose === 'function' && props.beforeClose('cancel') === false) return;
|
|
241
|
+
cancelOrClose({
|
|
242
|
+
props: props,
|
|
243
|
+
state: state,
|
|
244
|
+
constants: constants
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
export var handleBeforeClose = function handleBeforeClose(_ref14) {
|
|
249
|
+
var props = _ref14.props,
|
|
250
|
+
state = _ref14.state,
|
|
251
|
+
constants = _ref14.constants;
|
|
252
|
+
return function () {
|
|
253
|
+
if (typeof props.beforeClose === 'function' && props.beforeClose('close') === false) {
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
cancelOrClose({
|
|
257
|
+
props: props,
|
|
258
|
+
state: state,
|
|
259
|
+
constants: constants
|
|
260
|
+
});
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
export var handleSizeChange = function handleSizeChange(_ref15) {
|
|
264
|
+
var api = _ref15.api,
|
|
265
|
+
emit = _ref15.emit,
|
|
266
|
+
state = _ref15.state;
|
|
267
|
+
return function (val) {
|
|
268
|
+
state.pagerConfig.currentPage = val;
|
|
269
|
+
api.handlePager();
|
|
270
|
+
emit('page-change', val);
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
var renderTextHandler = function renderTextHandler(_ref16) {
|
|
274
|
+
var state = _ref16.state,
|
|
275
|
+
props = _ref16.props,
|
|
276
|
+
datas = _ref16.datas,
|
|
277
|
+
dataset = _ref16.dataset,
|
|
278
|
+
value = _ref16.value;
|
|
279
|
+
var rows = [];
|
|
280
|
+
var arrValues;
|
|
281
|
+
if (Array.isArray(value)) {
|
|
282
|
+
arrValues = value.slice(0);
|
|
283
|
+
} else {
|
|
284
|
+
arrValues = value && ~['string', 'number'].indexOf(_typeof(value)) ? value.toString().split(props.valueSplit) : [];
|
|
285
|
+
}
|
|
286
|
+
arrValues.forEach(function (val) {
|
|
287
|
+
var item = find(dataset, function (data) {
|
|
288
|
+
return val == data[props.valueField];
|
|
289
|
+
}) || find(datas, function (data) {
|
|
290
|
+
return val == data[props.valueField];
|
|
291
|
+
});
|
|
292
|
+
item && rows.push(item);
|
|
293
|
+
});
|
|
294
|
+
if (props.multi) {
|
|
295
|
+
state.selectedValues = arrValues;
|
|
296
|
+
state.selectedDatas = rows;
|
|
297
|
+
state.cacheStore = {
|
|
298
|
+
selectedDatas: rows.slice(0),
|
|
299
|
+
selectedValues: arrValues.slice(0)
|
|
300
|
+
};
|
|
301
|
+
} else {
|
|
302
|
+
state.selectedDatas = rows[0];
|
|
303
|
+
state.commitValue = state.selectedDatas ? state.selectedDatas[props.valueField] : '';
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
var getTreeSelectList = function getTreeSelectList(_ref17) {
|
|
307
|
+
var value = _ref17.value,
|
|
308
|
+
state = _ref17.state,
|
|
309
|
+
props = _ref17.props;
|
|
310
|
+
value = typeOf(value) === 'number' ? isNaN(value) ? '' : '' + value : value;
|
|
311
|
+
var treeSelectList = [];
|
|
312
|
+
if (!isNullOrEmpty(value)) {
|
|
313
|
+
var values = value.split(props.valueSplit);
|
|
314
|
+
var selectdTreeNodeList = [];
|
|
315
|
+
var _state$treeOp$props = state.treeOp.props,
|
|
316
|
+
id = _state$treeOp$props.id,
|
|
317
|
+
label = _state$treeOp$props.label,
|
|
318
|
+
children = _state$treeOp$props.children;
|
|
319
|
+
eachTree(state.treeOp.data, function (node) {
|
|
320
|
+
if (values.some(function (val) {
|
|
321
|
+
return val == node[id];
|
|
322
|
+
})) {
|
|
323
|
+
selectdTreeNodeList.push({
|
|
324
|
+
id: node[id],
|
|
325
|
+
value: node[label]
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}, {
|
|
329
|
+
children: children
|
|
330
|
+
});
|
|
331
|
+
if (selectdTreeNodeList.length) {
|
|
332
|
+
treeSelectList = selectdTreeNodeList;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return treeSelectList;
|
|
336
|
+
};
|
|
337
|
+
export var initDisplay = function initDisplay(_ref18) {
|
|
338
|
+
var api = _ref18.api,
|
|
339
|
+
constants = _ref18.constants,
|
|
340
|
+
props = _ref18.props,
|
|
341
|
+
state = _ref18.state,
|
|
342
|
+
nextTick = _ref18.nextTick;
|
|
343
|
+
return function (value) {
|
|
344
|
+
var dataset = props.remoteSearch || props.dataset ? state.sourceGridDataset.concat(state.selectedDatas || '') : props.gridOp && props.gridOp.data || [];
|
|
345
|
+
var getRenderTextData = props.textRenderSource || function () {
|
|
346
|
+
return Promise.resolve([]);
|
|
347
|
+
};
|
|
348
|
+
if (props.popseletor !== constants.TYPE_TREE && (props.multi || props.textRenderSource)) {
|
|
349
|
+
getRenderTextData(value).then(function (datas) {
|
|
350
|
+
renderTextHandler({
|
|
351
|
+
state: state,
|
|
352
|
+
props: props,
|
|
353
|
+
datas: datas,
|
|
354
|
+
dataset: dataset,
|
|
355
|
+
value: value
|
|
356
|
+
});
|
|
357
|
+
nextTick(function () {
|
|
358
|
+
state.display = api.getDisplay({
|
|
359
|
+
props: props,
|
|
360
|
+
state: state
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
} else {
|
|
365
|
+
var item = find(dataset, function (data) {
|
|
366
|
+
return value == data[props.valueField];
|
|
367
|
+
});
|
|
368
|
+
state.selectedDatas = item ? item : value;
|
|
369
|
+
if (props.popseletor === constants.TYPE_GRID) {
|
|
370
|
+
state.commitValue = state.selectedDatas ? state.selectedDatas[props.valueField] : '';
|
|
371
|
+
} else if (props.popseletor === constants.TYPE_TREE) {
|
|
372
|
+
var treeSelectList = getTreeSelectList({
|
|
373
|
+
value: value,
|
|
374
|
+
state: state,
|
|
375
|
+
props: props
|
|
376
|
+
});
|
|
377
|
+
state.treeSelectList = treeSelectList;
|
|
378
|
+
state.cacheStore = {
|
|
379
|
+
treeSelectList: treeSelectList.slice(0)
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
nextTick(function () {
|
|
383
|
+
state.display = api.getDisplay({
|
|
384
|
+
props: props,
|
|
385
|
+
state: state
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
export var openDialog = function openDialog(_ref19) {
|
|
392
|
+
var api = _ref19.api,
|
|
393
|
+
props = _ref19.props,
|
|
394
|
+
state = _ref19.state,
|
|
395
|
+
emit = _ref19.emit;
|
|
396
|
+
return function () {
|
|
397
|
+
if (state.disabled) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
state.closeSuggestPanelInvoker = 'openDialog';
|
|
401
|
+
api.closeSuggestPanel(true);
|
|
402
|
+
state.open = true;
|
|
403
|
+
emit('popup');
|
|
404
|
+
props.autoLookup && props.alwaysLoad && api.query();
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
var localFilter = function localFilter(_ref20) {
|
|
408
|
+
var props = _ref20.props,
|
|
409
|
+
state = _ref20.state;
|
|
410
|
+
var keys = Object.keys(state.search);
|
|
411
|
+
var dataset = props.gridOp && props.gridOp.data || [];
|
|
412
|
+
return dataset.filter(function (item) {
|
|
413
|
+
return keys.every(function (key) {
|
|
414
|
+
return item[key] && item[key].toString().toLowerCase().indexOf(state.search[key].toLowerCase()) !== -1;
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
export var query = function query(_ref21) {
|
|
419
|
+
var props = _ref21.props,
|
|
420
|
+
state = _ref21.state,
|
|
421
|
+
parent = _ref21.parent,
|
|
422
|
+
constants = _ref21.constants;
|
|
423
|
+
return function (page) {
|
|
424
|
+
var remoteSearch = props.remoteSearch,
|
|
425
|
+
dataset = props.dataset;
|
|
426
|
+
page || (state.pagerConfig.currentPage = 1);
|
|
427
|
+
return new Promise(function (resolve) {
|
|
428
|
+
state.loading = true;
|
|
429
|
+
if (remoteSearch || dataset) {
|
|
430
|
+
var _state$pagerConfig = state.pagerConfig,
|
|
431
|
+
currentPage = _state$pagerConfig.currentPage,
|
|
432
|
+
pageSize = _state$pagerConfig.pageSize;
|
|
433
|
+
if (remoteSearch) {
|
|
434
|
+
props.remoteSearch({
|
|
435
|
+
page: {
|
|
436
|
+
currentPage: currentPage,
|
|
437
|
+
pageSize: pageSize
|
|
438
|
+
},
|
|
439
|
+
conditions: state.search
|
|
440
|
+
}).then(function (data) {
|
|
441
|
+
state.sourceGridDataset = data.data;
|
|
442
|
+
state.pagerConfig.total = data.total;
|
|
443
|
+
state.loading = false;
|
|
444
|
+
resolve();
|
|
445
|
+
})["finally"](function () {
|
|
446
|
+
state.loading = false;
|
|
447
|
+
});
|
|
448
|
+
} else {
|
|
449
|
+
getDataset({
|
|
450
|
+
dataset: dataset,
|
|
451
|
+
service: parent.$service,
|
|
452
|
+
tree: props.treeOp
|
|
453
|
+
}, {
|
|
454
|
+
pageVO: {
|
|
455
|
+
curPage: currentPage,
|
|
456
|
+
pageSize: pageSize
|
|
457
|
+
}
|
|
458
|
+
}).then(function (data) {
|
|
459
|
+
var result = data.result,
|
|
460
|
+
_data$pageVO = data.pageVO,
|
|
461
|
+
pageVO = _data$pageVO === void 0 ? {} : _data$pageVO;
|
|
462
|
+
if (props.popseletor === constants.TYPE_TREE) {
|
|
463
|
+
props.treeOp.data = result || data;
|
|
464
|
+
} else {
|
|
465
|
+
state.sourceGridDataset = result || data;
|
|
466
|
+
state.pagerConfig.total = pageVO.totalRows || 0;
|
|
467
|
+
}
|
|
468
|
+
state.loading = false;
|
|
469
|
+
resolve();
|
|
470
|
+
})["finally"](function () {
|
|
471
|
+
state.loading = false;
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
} else {
|
|
475
|
+
state.fullGridData = localFilter({
|
|
476
|
+
state: state,
|
|
477
|
+
props: props
|
|
478
|
+
});
|
|
479
|
+
state.loading = false;
|
|
480
|
+
resolve();
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
export var selectedGridSelectAll = function selectedGridSelectAll(_ref22) {
|
|
486
|
+
var constants = _ref22.constants,
|
|
487
|
+
vm = _ref22.vm,
|
|
488
|
+
state = _ref22.state;
|
|
489
|
+
return function (_ref23) {
|
|
490
|
+
var checked = _ref23.checked;
|
|
491
|
+
var refs = vm.$refs;
|
|
492
|
+
if (!checked) {
|
|
493
|
+
var sourcetable = refs[constants.GRID_REF.source];
|
|
494
|
+
var historytable = refs[constants.GRID_REF.history];
|
|
495
|
+
sourcetable && sourcetable.clearSelection();
|
|
496
|
+
historytable && historytable.clearSelection();
|
|
497
|
+
state.selectedValues = [];
|
|
498
|
+
state.selectedDatas = [];
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
};
|
|
502
|
+
var copySelectDatas = function copySelectDatas(state) {
|
|
503
|
+
state.selectedValues = state.selectedValues.slice(0);
|
|
504
|
+
state.selectedDatas = state.selectedDatas.slice(0);
|
|
505
|
+
};
|
|
506
|
+
export var selectedGridSelectChange = function selectedGridSelectChange(_ref24) {
|
|
507
|
+
var constants = _ref24.constants,
|
|
508
|
+
props = _ref24.props,
|
|
509
|
+
vm = _ref24.vm,
|
|
510
|
+
state = _ref24.state;
|
|
511
|
+
return function (_ref25, event) {
|
|
512
|
+
var checked = _ref25.checked,
|
|
513
|
+
row = _ref25.row;
|
|
514
|
+
var refs = vm.$refs;
|
|
515
|
+
if (!checked) {
|
|
516
|
+
var len = state.selectedValues.length;
|
|
517
|
+
event.target.checked = !checked;
|
|
518
|
+
for (var i = 0; i < len; i++) {
|
|
519
|
+
if (state.selectedValues[i] == row[props.valueField]) {
|
|
520
|
+
state.selectedValues.splice(i, 1);
|
|
521
|
+
state.selectedDatas.splice(i, 1);
|
|
522
|
+
var sourcetable = refs[constants.GRID_REF.source];
|
|
523
|
+
var historytable = refs[constants.GRID_REF.history];
|
|
524
|
+
sourcetable && sourcetable.setSelection(sourcetable.data.filter(function (lrow) {
|
|
525
|
+
return lrow[props.valueField] == row[props.valueField];
|
|
526
|
+
}), false);
|
|
527
|
+
historytable && historytable.setSelection(historytable.data.filter(function (lrow) {
|
|
528
|
+
return lrow[props.valueField] == row[props.valueField];
|
|
529
|
+
}), false);
|
|
530
|
+
break;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
copySelectDatas(state);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
export var sourceGridSelectAll = function sourceGridSelectAll(_ref26) {
|
|
538
|
+
var props = _ref26.props,
|
|
539
|
+
state = _ref26.state,
|
|
540
|
+
api = _ref26.api;
|
|
541
|
+
return function (_ref27) {
|
|
542
|
+
var selection = _ref27.selection,
|
|
543
|
+
checked = _ref27.checked;
|
|
544
|
+
if (checked) {
|
|
545
|
+
selection.forEach(function (item) {
|
|
546
|
+
if (!find(state.selectedValues, function (val) {
|
|
547
|
+
return val == item[props.valueField];
|
|
548
|
+
})) {
|
|
549
|
+
state.selectedValues.push(item[props.valueField]);
|
|
550
|
+
state.selectedDatas.push(item);
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
} else {
|
|
554
|
+
var len = state.sourceGridDataset.length;
|
|
555
|
+
var _loop = function _loop(i) {
|
|
556
|
+
var sourceGridItem = state.sourceGridDataset[i][props.valueField];
|
|
557
|
+
var selectedItem = find(state.selectedValues, function (val) {
|
|
558
|
+
return val == sourceGridItem;
|
|
559
|
+
});
|
|
560
|
+
var index = state.selectedValues.indexOf(selectedItem);
|
|
561
|
+
if (index !== -1) {
|
|
562
|
+
state.selectedValues.splice(index, 1);
|
|
563
|
+
state.selectedDatas.splice(index, 1);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
for (var i = 0; i < len; i++) {
|
|
567
|
+
_loop(i);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (state.showSuggestPanel) {
|
|
571
|
+
if (!checked) {
|
|
572
|
+
state.selectedValues = [];
|
|
573
|
+
state.selectedDatas = [];
|
|
574
|
+
}
|
|
575
|
+
api.handleConfirm();
|
|
576
|
+
}
|
|
577
|
+
copySelectDatas(state);
|
|
578
|
+
};
|
|
579
|
+
};
|
|
580
|
+
export var sourceGridSelectChange = function sourceGridSelectChange(_ref28) {
|
|
581
|
+
var props = _ref28.props,
|
|
582
|
+
state = _ref28.state,
|
|
583
|
+
api = _ref28.api;
|
|
584
|
+
return function (_ref29) {
|
|
585
|
+
var checked = _ref29.checked,
|
|
586
|
+
row = _ref29.row,
|
|
587
|
+
confirm = _ref29.confirm;
|
|
588
|
+
if (checked) {
|
|
589
|
+
state.selectedValues.push(row[props.valueField]);
|
|
590
|
+
state.selectedDatas.push(row);
|
|
591
|
+
} else {
|
|
592
|
+
state.selectedValues.forEach(function (item, index) {
|
|
593
|
+
if (row[props.valueField] == item) {
|
|
594
|
+
state.selectedValues.splice(index, 1);
|
|
595
|
+
state.selectedDatas.splice(index, 1);
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
if (state.showSuggestPanel && confirm !== false) {
|
|
600
|
+
api.handleConfirm();
|
|
601
|
+
}
|
|
602
|
+
copySelectDatas(state);
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
export var filterNode = function filterNode() {
|
|
606
|
+
return function (value, data) {
|
|
607
|
+
if (!value) return true;
|
|
608
|
+
return data.label.indexOf(value) !== -1;
|
|
609
|
+
};
|
|
610
|
+
};
|
|
611
|
+
export var watchFilterText = function watchFilterText(vm) {
|
|
612
|
+
return function (value) {
|
|
613
|
+
var refs = vm.$refs;
|
|
614
|
+
if (refs.tree) {
|
|
615
|
+
refs.tree.filter(value);
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
};
|
|
619
|
+
export var computedTreeOp = function computedTreeOp(_ref30) {
|
|
620
|
+
var api = _ref30.api,
|
|
621
|
+
constants = _ref30.constants;
|
|
622
|
+
return function (props, state) {
|
|
623
|
+
var treeOp = props.treeOp;
|
|
624
|
+
if (typeof treeOp.showCheckbox === 'undefined' && typeof treeOp.showRadio === 'undefined') {
|
|
625
|
+
treeOp.showCheckbox = true;
|
|
626
|
+
}
|
|
627
|
+
if (typeof treeOp.defaultExpandAll === 'undefined') {
|
|
628
|
+
treeOp.defaultExpandAll = true;
|
|
629
|
+
}
|
|
630
|
+
treeOp.showCheckbox = treeOp.showCheckbox === true;
|
|
631
|
+
treeOp.showRadio = treeOp.showRadio === true;
|
|
632
|
+
treeOp.filterNodeMethod = treeOp.filterNodeMethod || api.filterNode;
|
|
633
|
+
treeOp.defaultExpandAll = treeOp.defaultExpandAll === true;
|
|
634
|
+
treeOp.checkStrictly = treeOp.checkStrictly === false ? false : true;
|
|
635
|
+
treeOp.expandOnClickNode = false;
|
|
636
|
+
treeOp.nodeKey = treeOp.nodeKey || constants.ID;
|
|
637
|
+
treeOp.defaultCheckedKeys = state.treeSelectList.map(function (item) {
|
|
638
|
+
return item.id;
|
|
639
|
+
});
|
|
640
|
+
treeOp.props = _objectSpread({
|
|
641
|
+
label: props.textField || constants.LABEL,
|
|
642
|
+
id: props.valueField || constants.ID,
|
|
643
|
+
children: 'children'
|
|
644
|
+
}, treeOp.props);
|
|
645
|
+
return treeOp;
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
export var treeCheckChange = function treeCheckChange(_ref31) {
|
|
649
|
+
var constants = _ref31.constants,
|
|
650
|
+
state = _ref31.state,
|
|
651
|
+
props = _ref31.props;
|
|
652
|
+
return function (data, checked) {
|
|
653
|
+
if (state.treeOp.showRadio) {
|
|
654
|
+
var valueField = props.valueField || constants.ID;
|
|
655
|
+
var textField = props.textField || constants.LABEL;
|
|
656
|
+
var treeSelectList = [{
|
|
657
|
+
id: data[valueField],
|
|
658
|
+
value: data[textField]
|
|
659
|
+
}];
|
|
660
|
+
state.treeSelectList = treeSelectList;
|
|
661
|
+
} else {
|
|
662
|
+
if (checked) {
|
|
663
|
+
state.treeSelectList.push({
|
|
664
|
+
id: data[state.treeOp.props.id],
|
|
665
|
+
value: data[state.treeOp.props.label]
|
|
666
|
+
});
|
|
667
|
+
} else {
|
|
668
|
+
state.treeSelectList = state.treeSelectList.filter(function (item) {
|
|
669
|
+
return item.id !== data[state.treeOp.props.id];
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
export var handleNumberPageChange = function handleNumberPageChange(_ref32) {
|
|
676
|
+
var api = _ref32.api,
|
|
677
|
+
emit = _ref32.emit,
|
|
678
|
+
state = _ref32.state;
|
|
679
|
+
return function (size) {
|
|
680
|
+
state.pagerConfig.currentPage = 1;
|
|
681
|
+
state.pagerConfig.pageSize = size;
|
|
682
|
+
api.handlePager();
|
|
683
|
+
emit('size-change', size);
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
export var doSearch = function doSearch(_ref33) {
|
|
687
|
+
var api = _ref33.api,
|
|
688
|
+
state = _ref33.state,
|
|
689
|
+
props = _ref33.props;
|
|
690
|
+
return function (params) {
|
|
691
|
+
var conditions = props.conditions;
|
|
692
|
+
for (var i = 0; i < conditions.length; i++) {
|
|
693
|
+
var condition = conditions[i];
|
|
694
|
+
if (_typeof(params) === 'object' && typeof params[condition.field] !== 'undefined') {
|
|
695
|
+
state.searchOp[condition.field] = params[condition.field] ? params[condition.field] : '';
|
|
696
|
+
state.search[condition.field] = params[condition.field] ? params[condition.field] : '';
|
|
697
|
+
} else {
|
|
698
|
+
state.search[condition.field] = state.searchOp[condition.field];
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
api.handleSearch();
|
|
702
|
+
};
|
|
703
|
+
};
|
|
704
|
+
export var doClear = function doClear(_ref34) {
|
|
705
|
+
var api = _ref34.api,
|
|
706
|
+
state = _ref34.state,
|
|
707
|
+
props = _ref34.props;
|
|
708
|
+
return function (params) {
|
|
709
|
+
var conditions = props.conditions;
|
|
710
|
+
for (var i = 0; i < conditions.length; i++) {
|
|
711
|
+
var condition = conditions[i];
|
|
712
|
+
if (_typeof(params) === 'object' && typeof params[condition.field] !== 'undefined') {
|
|
713
|
+
params[condition.field] = '';
|
|
714
|
+
}
|
|
715
|
+
state.searchOp[condition.field] = '';
|
|
716
|
+
state.search[condition.field] = '';
|
|
717
|
+
}
|
|
718
|
+
api.handleSearch();
|
|
719
|
+
};
|
|
720
|
+
};
|
|
721
|
+
export var getSuggestParam = function getSuggestParam(_ref35) {
|
|
722
|
+
var state = _ref35.state,
|
|
723
|
+
props = _ref35.props,
|
|
724
|
+
api = _ref35.api;
|
|
725
|
+
return function (input) {
|
|
726
|
+
if (typeof input !== 'string') {
|
|
727
|
+
input = state.display;
|
|
728
|
+
}
|
|
729
|
+
if (!props.bypass) {
|
|
730
|
+
var texts = api.getDisplay().split(props.textSplit);
|
|
731
|
+
var inputs = input.split(props.textSplit).filter(function (s) {
|
|
732
|
+
return !!s;
|
|
733
|
+
});
|
|
734
|
+
var removed = texts.filter(function (str) {
|
|
735
|
+
return !~inputs.indexOf(str);
|
|
736
|
+
});
|
|
737
|
+
var addtions = inputs.filter(function (str) {
|
|
738
|
+
return !~texts.indexOf(str);
|
|
739
|
+
});
|
|
740
|
+
return {
|
|
741
|
+
addtions: addtions,
|
|
742
|
+
removed: removed
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
return input;
|
|
746
|
+
};
|
|
747
|
+
};
|
|
748
|
+
export var updateSuggestWidth = function updateSuggestWidth(_ref36) {
|
|
749
|
+
var refs = _ref36.refs;
|
|
750
|
+
return function () {
|
|
751
|
+
var $input = refs.reference.getInput();
|
|
752
|
+
refs.popper.style.width = $input.clientWidth + 'px';
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
export var doSuggesst = function doSuggesst(_ref37) {
|
|
756
|
+
var state = _ref37.state,
|
|
757
|
+
props = _ref37.props,
|
|
758
|
+
popper = _ref37.popper,
|
|
759
|
+
api = _ref37.api;
|
|
760
|
+
return function (event) {
|
|
761
|
+
if (!props.suggest) return;
|
|
762
|
+
var query = event;
|
|
763
|
+
off(window, 'resize', api.updateSuggestWidth);
|
|
764
|
+
off(document, 'click', api.closeSuggestPanel);
|
|
765
|
+
on(document, 'click', api.closeSuggestPanel);
|
|
766
|
+
on(window, 'resize', api.updateSuggestWidth);
|
|
767
|
+
api.updateSuggestWidth();
|
|
768
|
+
if (typeof event !== 'string') {
|
|
769
|
+
if (props.multi && !state.suggestList.length) {
|
|
770
|
+
state.suggestList = [].concat(state.selectedDatas);
|
|
771
|
+
}
|
|
772
|
+
state.showSuggestPanel = true;
|
|
773
|
+
}
|
|
774
|
+
if (props.remoteSearch) {
|
|
775
|
+
var doQuery = function doQuery(query) {
|
|
776
|
+
state.showSuggestPanel = true;
|
|
777
|
+
props.remoteSearch({
|
|
778
|
+
query: query
|
|
779
|
+
}).then(function (data) {
|
|
780
|
+
state.suggestList = data.data;
|
|
781
|
+
popper.updatePopper();
|
|
782
|
+
});
|
|
783
|
+
};
|
|
784
|
+
if (!props.bypass && props.multi) {
|
|
785
|
+
var _api$getSuggestParam = api.getSuggestParam(event),
|
|
786
|
+
removed = _api$getSuggestParam.removed,
|
|
787
|
+
addtions = _api$getSuggestParam.addtions;
|
|
788
|
+
query = addtions;
|
|
789
|
+
removed.forEach(function (text) {
|
|
790
|
+
var row = find(state.selectedDatas, function (node) {
|
|
791
|
+
return text === node[props.textField];
|
|
792
|
+
});
|
|
793
|
+
api.sourceGridSelectChange({
|
|
794
|
+
checked: false,
|
|
795
|
+
row: row,
|
|
796
|
+
confirm: false
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
if (addtions.length) {
|
|
800
|
+
doQuery(query);
|
|
801
|
+
}
|
|
802
|
+
} else {
|
|
803
|
+
doQuery(state.display);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
};
|
|
808
|
+
export var closeSuggestPanel = function closeSuggestPanel(_ref38) {
|
|
809
|
+
var state = _ref38.state,
|
|
810
|
+
api = _ref38.api,
|
|
811
|
+
refs = _ref38.refs;
|
|
812
|
+
return function () {
|
|
813
|
+
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
814
|
+
var reference = refs.reference,
|
|
815
|
+
popper = refs.popper;
|
|
816
|
+
var keep = !event;
|
|
817
|
+
if (event.target) {
|
|
818
|
+
keep = reference.$el.contains(event.target) || popper.contains(event.target);
|
|
819
|
+
}
|
|
820
|
+
if (!keep) {
|
|
821
|
+
off(document, 'click', api.closeSuggestPanel);
|
|
822
|
+
off(window, 'resize', api.updateSuggestWidth);
|
|
823
|
+
api.handleConfirm(state.closeSuggestPanelInvoker === 'openDialog');
|
|
824
|
+
state.closeSuggestPanelInvoker = null;
|
|
825
|
+
state.showSuggestPanel = false;
|
|
826
|
+
}
|
|
827
|
+
};
|
|
828
|
+
};
|
|
829
|
+
export var suggestRadioChange = function suggestRadioChange(_ref39) {
|
|
830
|
+
var state = _ref39.state,
|
|
831
|
+
api = _ref39.api;
|
|
832
|
+
return function (_ref40) {
|
|
833
|
+
var row = _ref40.row;
|
|
834
|
+
state.selectedDatas = row;
|
|
835
|
+
state.showSuggestPanel = false;
|
|
836
|
+
api.handleConfirm();
|
|
837
|
+
};
|
|
838
|
+
};
|
|
839
|
+
export var handlePager = function handlePager(_ref41) {
|
|
840
|
+
var api = _ref41.api,
|
|
841
|
+
props = _ref41.props,
|
|
842
|
+
state = _ref41.state;
|
|
843
|
+
return function () {
|
|
844
|
+
if (!props.showPager) {
|
|
845
|
+
state.sourceGridDataset = state.fullGridData;
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
var data = state.fullGridData;
|
|
849
|
+
var _state$pagerConfig2 = state.pagerConfig,
|
|
850
|
+
pageSize = _state$pagerConfig2.pageSize,
|
|
851
|
+
currentPage = _state$pagerConfig2.currentPage;
|
|
852
|
+
if (!props.remoteSearch && !props.dataset) {
|
|
853
|
+
state.sourceGridDataset = data.slice((currentPage - 1) * pageSize, currentPage * pageSize);
|
|
854
|
+
state.pagerConfig.total = data.length;
|
|
855
|
+
} else {
|
|
856
|
+
api.query(true);
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
};
|
|
860
|
+
export var initSearchOption = function initSearchOption(_ref42) {
|
|
861
|
+
var api = _ref42.api,
|
|
862
|
+
state = _ref42.state;
|
|
863
|
+
return function (conditions) {
|
|
864
|
+
for (var i = 0; i < conditions.length; i++) {
|
|
865
|
+
var condition = conditions[i];
|
|
866
|
+
state.searchOp[condition.field] = '';
|
|
867
|
+
}
|
|
868
|
+
state.searchOp.doSearch = api.doSearch;
|
|
869
|
+
state.searchOp.doClear = api.doClear;
|
|
870
|
+
};
|
|
871
|
+
};
|
|
872
|
+
export var mounted = function mounted(_ref43) {
|
|
873
|
+
var api = _ref43.api,
|
|
874
|
+
props = _ref43.props;
|
|
875
|
+
return function () {
|
|
876
|
+
if (props.autoLookup) {
|
|
877
|
+
api.query().then(function () {
|
|
878
|
+
api.initDisplay(props.modelValue);
|
|
879
|
+
});
|
|
880
|
+
} else {
|
|
881
|
+
api.initDisplay(props.modelValue);
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
};
|