@opentiny/vue-renderless 3.13.1 → 3.14.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 +20 -13
- package/action-sheet/vue.js +8 -7
- package/amount/index.js +100 -25
- package/amount/vue.js +102 -26
- package/anchor/index.js +1 -0
- package/area/index.js +8 -8
- package/area/vue.js +5 -5
- package/async-flowchart/index.js +16 -3
- package/autocomplete/index.js +58 -14
- package/autocomplete/vue.js +40 -12
- package/badge/index.js +12 -0
- package/badge/vue.js +6 -4
- package/breadcrumb/vue.js +3 -1
- package/breadcrumb-item/vue.js +6 -2
- package/button/index.js +5 -1
- package/calendar/index.js +2 -86
- package/calendar-bar/index.js +18 -4
- package/calendar-view/index.js +5 -1
- package/calendar-view/vue.js +16 -3
- package/card-group/vue.js +4 -2
- package/cascader/index.js +86 -34
- package/cascader/vue.js +61 -20
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +36 -23
- package/cascader-mobile/vue.js +6 -0
- package/cascader-node/index.js +13 -1
- package/cascader-node/vue.js +15 -4
- package/cascader-panel/index.js +1 -1
- package/cascader-select/column-index.js +150 -0
- package/cascader-select/column.js +120 -0
- package/cascader-select/index.js +29 -165
- package/cascader-select/usePicker.js +251 -0
- package/cascader-select/useTouch.js +65 -0
- package/cascader-select/vue.js +35 -47
- package/cell/vue.js +2 -1
- package/chart-bar/index.js +2 -3
- package/chart-core/deps/constants.js +43 -43
- package/chart-core/index.js +1 -1
- package/chart-gauge/index.js +2 -2
- package/chart-heatmap/index.js +17 -10
- package/chart-line/index.js +8 -9
- package/chart-tree/index.js +2 -2
- package/chart-waterfall/index.js +4 -6
- package/checkbox/index.js +18 -1
- package/checkbox/vue.js +15 -7
- package/checkbox-group/vue.js +1 -0
- package/col/vue.js +1 -1
- package/collapse/index.js +3 -3
- package/color-select-panel/vue.js +0 -7
- package/column-list-item/index.js +17 -1
- package/column-list-item/vue.js +8 -3
- package/common/date.js +7 -5
- package/common/deps/clickoutside.js +6 -2
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +44 -11
- package/common/deps/resize-event.js +1 -0
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +2 -2
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +38 -20
- package/common/index.js +2 -2
- package/common/runtime.js +1 -1
- package/common/string.js +2 -2
- package/common/type.js +2 -1
- package/common/validate/rules/enum.js +1 -1
- package/common/validate/rules/pattern.js +2 -2
- package/common/validate/rules/range.js +8 -5
- package/common/validate/rules/required.js +1 -1
- package/common/validate/rules/type.js +5 -5
- package/common/validate/rules/whitespace.js +1 -1
- package/common/validate/util.js +15 -16
- package/common/validate/validations/integer.js +1 -1
- package/common/validate/validations/method.js +1 -1
- package/currency/index.js +74 -7
- package/currency/vue.js +21 -5
- package/date-panel/index.js +16 -0
- package/date-panel/vue.js +8 -2
- package/date-picker-mobile/index.js +12 -0
- package/date-picker-mobile/vue.js +7 -1
- package/date-range/vue.js +14 -6
- package/date-table/index.js +5 -0
- package/date-table/vue.js +3 -1
- package/dialog-box/index.js +46 -14
- package/dialog-box/vue.js +30 -7
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +27 -5
- package/drawer/vue.js +14 -7
- package/dropdown/index.js +7 -7
- package/dropdown/vue.js +6 -2
- package/dropdown-item/index.js +9 -1
- package/dropdown-item/mf.js +6 -10
- package/dropdown-item/vue.js +20 -7
- package/dropdown-menu/index.js +20 -7
- package/dropdown-menu/vue.js +4 -3
- package/exception/index.js +2 -7
- package/exception/vue.js +7 -10
- package/fall-menu/index.js +5 -1
- package/fall-menu/vue.js +13 -2
- package/file-upload/index.js +68 -18
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -0
- package/float-button/index.js +42 -0
- package/float-button/vue.js +101 -0
- package/floating-button/index.js +62 -16
- package/floating-button/vue.js +27 -9
- package/flowchart/index.js +134 -25
- package/flowchart/node.js +13 -4
- package/flowchart/vue.js +16 -4
- package/form/vue.js +8 -0
- package/form-item/index.js +5 -5
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/plugins/export.js +5 -2
- package/grid/utils/column.js +1 -0
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -1
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +81 -20
- package/input/vue.js +44 -18
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/link/vue.js +3 -1
- package/loading/index.js +2 -2
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/menu/index.js +15 -2
- package/menu/vue.js +22 -17
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/modal/index.js +44 -4
- package/modal/vue.js +18 -4
- package/multi-select/index.js +186 -11
- package/multi-select/vue.js +60 -15
- package/multi-select-item/index.js +23 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +46 -12
- package/numeric/vue.js +44 -19
- package/option/index.js +27 -9
- package/option/vue.js +37 -21
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +18 -4
- package/pager/vue.js +16 -5
- package/picker/index.js +258 -49
- package/picker/mb.js +42 -0
- package/picker/vue.js +70 -17
- package/picker-column/index.js +1 -1
- package/pop-upload/vue.js +3 -0
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +71 -32
- package/popeditor/vue.js +15 -11
- package/popover/index.js +4 -4
- package/popover/vue.js +6 -6
- package/popup/index.js +3 -3
- package/popup/vue.js +5 -5
- package/pull-refresh/index.js +13 -13
- package/pull-refresh/vue.js +5 -4
- package/radio/index.js +0 -17
- package/radio/vue.js +4 -10
- package/rate/index.js +1 -1
- package/rate/vue.js +0 -2
- package/record/index.js +4 -1
- package/rich-text/clipboard.js +54 -0
- package/rich-text/index.js +192 -0
- package/rich-text/module/file-upload.js +107 -0
- package/rich-text/module/image-drop.js +63 -0
- package/rich-text/module/image-upload.js +89 -0
- package/rich-text/options.js +141 -0
- package/rich-text/table-module.js +382 -0
- package/rich-text/vue.js +102 -0
- package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
- package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
- package/scrollbar/index.js +11 -11
- package/scrollbar/vue-bar.js +3 -3
- package/scrollbar/vue.js +5 -5
- package/search/index.js +9 -9
- package/search/vue.js +8 -6
- package/select/index.js +457 -389
- package/select/vue.js +257 -161
- package/select-dropdown/index.js +61 -3
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- package/selected-box/index.js +2 -0
- package/selected-box/vue.js +6 -3
- package/signature/index.js +241 -0
- package/signature/vue.js +88 -0
- package/skeleton/index.js +14 -0
- package/skeleton/vue.js +15 -0
- package/skeleton-item/vue.js +15 -0
- package/slider/index.js +70 -17
- package/slider/vue.js +16 -7
- package/split/index.js +5 -3
- package/split/vue.js +4 -6
- package/standard-list-item/index.js +15 -1
- package/standard-list-item/vue.js +6 -5
- package/steps/index.js +25 -2
- package/steps/slide-bar.js +8 -1
- package/steps/vue.js +15 -3
- package/tab-item-mf/vue.js +14 -8
- package/tab-nav/index.js +30 -5
- package/tab-nav/vue.js +16 -4
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +16 -4
- package/tabs/vue.js +2 -1
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tabs-mf/wheel.js +1 -0
- package/tag/index.js +1 -1
- package/tag-group/index.js +2 -1
- package/time/index.js +5 -2
- package/time/vue.js +1 -1
- package/time-line/index.js +3 -3
- package/time-line/vue.js +2 -2
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +6 -3
- package/tooltip/vue.js +4 -4
- package/transfer/index.js +20 -22
- package/transfer/vue.js +1 -6
- package/transfer-panel/vue.js +3 -5
- package/tree/index.js +21 -4
- package/tree/vue.js +10 -8
- package/tree-menu/index.js +31 -5
- package/tree-menu/vue.js +28 -15
- package/tree-node/index.js +18 -18
- package/tree-node/vue.js +6 -5
- package/types/action-sheet.type.d.ts +118 -1
- package/types/alert.type.d.ts +1 -1
- package/types/amount.type.d.ts +168 -1
- package/types/area.type.d.ts +134 -1
- package/types/async-flowchart.type.d.ts +72 -0
- package/types/autocomplete.type.d.ts +199 -1
- package/types/badge.type.d.ts +3 -1
- package/types/breadcrumb-item.type.d.ts +2 -0
- package/types/breadcrumb.type.d.ts +2 -0
- package/types/button-group.type.d.ts +3 -3
- package/types/button.type.d.ts +4 -0
- package/types/cascader-menu.type.d.ts +3 -4
- package/types/cascader-node.type.d.ts +5 -2
- package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
- package/types/cascader-panel.type.d.ts +3 -241
- package/types/cascader.type.d.ts +329 -1
- package/types/checkbox.type.d.ts +9 -3
- package/types/collapse.type.d.ts +20 -3
- package/types/date-picker.type.d.ts +37 -0
- package/types/dialog-box.type.d.ts +13 -3
- package/types/drawer.type.d.ts +133 -1
- package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +1 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/float-button.type.d.ts +123 -0
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-222799ae.d.ts} +5 -2
- package/types/form.type.d.ts +1 -1
- package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
- package/types/input.type.d.ts +1 -5
- package/types/ip-address.type.d.ts +160 -1
- package/types/link.type.d.ts +6 -3
- package/types/loading.type.d.ts +7 -0
- package/types/milestone.type.d.ts +1 -1
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +29 -2
- package/types/numeric.type.d.ts +41 -10
- package/types/pager.type.d.ts +13 -1
- package/types/picker.type.d.ts +18 -0
- package/types/popconfirm.type.d.ts +86 -1
- package/types/popeditor.type.d.ts +5 -1
- package/types/popover.type.d.ts +3 -3
- package/types/progress.type.d.ts +3 -1
- package/types/radio.type.d.ts +0 -4
- package/types/rate.type.d.ts +236 -1
- package/types/search.type.d.ts +88 -1
- package/types/shared.type.d.ts +1 -1
- package/types/skeleton-item.type.d.ts +38 -0
- package/types/skeleton.type.d.ts +45 -0
- package/types/slider.type.d.ts +49 -10
- package/types/steps.type.d.ts +15 -4
- package/types/switch.type.d.ts +3 -3
- package/types/tab-bar.type.d.ts +1 -1
- package/types/tab-nav.type.d.ts +7 -2
- package/types/tabs.type.d.ts +9 -1
- package/types/tag-group.type.d.ts +64 -1
- package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/types/tooltip.type.d.ts +2 -2
- package/types/transfer.type.d.ts +185 -1
- package/types/tree-menu.type.d.ts +210 -1
- package/types/upload-dragger.type.d.ts +2 -2
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-a29aea50.d.ts} +31 -8
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-head.type.d.ts +146 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +64 -34
- package/upload/vue.js +9 -5
- package/upload-dragger/index.js +22 -20
- package/upload-list/index.js +24 -18
- package/upload-list/vue.js +9 -4
- package/user/index.js +34 -25
- package/user/vue.js +1 -1
- package/user-head/index.js +3 -3
- package/watermark/index.js +11 -0
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
- package/common/deps/modal-queue.js +0 -6
- package/common/deps/requestAnimationFrame.js +0 -25
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-G2ADBYYC.js";
|
|
5
|
+
const DEFAULT_FILED_NAMES = {
|
|
6
|
+
text: "label",
|
|
7
|
+
value: "id",
|
|
8
|
+
children: "children"
|
|
9
|
+
};
|
|
10
|
+
const createSourceData = ({ props, state, api }) => () => {
|
|
11
|
+
if (!api.validProps())
|
|
12
|
+
return;
|
|
13
|
+
const { options, valueField, textField, type } = props;
|
|
14
|
+
if (type === "cascade")
|
|
15
|
+
return options;
|
|
16
|
+
const values = api.parseType(state.defaultValues.slice());
|
|
17
|
+
const types = Array.from({ length: values.length });
|
|
18
|
+
const ranges = Array.from({ length: values.length });
|
|
19
|
+
const indices = Array.from({ length: values.length });
|
|
20
|
+
const visibleOptions = options.map((opt, i) => {
|
|
21
|
+
let slicedValues, existOption;
|
|
22
|
+
if (Array.isArray(opt)) {
|
|
23
|
+
if (opt.length === 0)
|
|
24
|
+
return [];
|
|
25
|
+
let index = opt.findIndex((item) => item[valueField] === values[i]);
|
|
26
|
+
index = index === -1 ? 0 : index;
|
|
27
|
+
types[i] = "a";
|
|
28
|
+
ranges[i] = [0, opt.length - 1];
|
|
29
|
+
indices[i] = index;
|
|
30
|
+
slicedValues = api.sliceValue(0, opt.length - 1);
|
|
31
|
+
existOption = (i2) => opt[i2];
|
|
32
|
+
} else if (opt && typeof opt === "object") {
|
|
33
|
+
let range;
|
|
34
|
+
if (Array.isArray(opt.range)) {
|
|
35
|
+
range = opt.range.slice(0, 2);
|
|
36
|
+
} else if (typeof opt.rangeMethod === "function") {
|
|
37
|
+
range = opt.rangeMethod(...values);
|
|
38
|
+
state.isOldCascadeType = true;
|
|
39
|
+
}
|
|
40
|
+
types[i] = "o";
|
|
41
|
+
ranges[i] = api.parseType(range);
|
|
42
|
+
slicedValues = api.sliceValue(ranges[i][0], ranges[i][1]);
|
|
43
|
+
existOption = (i2) => opt.optionMethod(i2, ...values);
|
|
44
|
+
}
|
|
45
|
+
if (!slicedValues || !existOption)
|
|
46
|
+
return [];
|
|
47
|
+
return slicedValues.map((slicedValue) => {
|
|
48
|
+
const option = slicedValue === null ? { [valueField]: null, [textField]: "" } : existOption(slicedValue);
|
|
49
|
+
return option;
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
return visibleOptions;
|
|
53
|
+
};
|
|
54
|
+
const changeHandler = ({ state, columnFieldNames, columnsType, api }) => (columnIndex, option) => {
|
|
55
|
+
const fields = columnFieldNames.value;
|
|
56
|
+
if (option && Object.keys(option).length) {
|
|
57
|
+
state.defaultValues = state.defaultValues ? state.defaultValues : [];
|
|
58
|
+
if (columnsType.value === "cascade") {
|
|
59
|
+
state.defaultValues[columnIndex] = option[fields.value] || "";
|
|
60
|
+
let index = columnIndex;
|
|
61
|
+
let cursor = option;
|
|
62
|
+
while (cursor && cursor[fields.children] && cursor[fields.children][0]) {
|
|
63
|
+
state.defaultValues[index + 1] = cursor[fields.children][0][fields.value];
|
|
64
|
+
index++;
|
|
65
|
+
cursor = cursor[fields.children][0];
|
|
66
|
+
}
|
|
67
|
+
if (cursor && cursor[fields.children] && cursor[fields.children].length === 0) {
|
|
68
|
+
state.defaultValues = state.defaultValues.slice(0, index + 1);
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
state.defaultValues[columnIndex] = Object.prototype.hasOwnProperty.call(option, fields.value) ? option[fields.value] : "";
|
|
72
|
+
}
|
|
73
|
+
api.change(columnIndex);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const formatCascade = ({ columnFieldNames }) => (columns, defaultValues) => {
|
|
77
|
+
const formatted = [];
|
|
78
|
+
const fields = columnFieldNames.value;
|
|
79
|
+
let cursor = {
|
|
80
|
+
text: "",
|
|
81
|
+
value: "",
|
|
82
|
+
[fields.children]: columns
|
|
83
|
+
};
|
|
84
|
+
let columnIndex = 0;
|
|
85
|
+
while (cursor && cursor[fields.children]) {
|
|
86
|
+
const options = cursor[fields.children];
|
|
87
|
+
const value = defaultValues[columnIndex];
|
|
88
|
+
let index = options.findIndex((columnItem) => columnItem[fields.value] === value);
|
|
89
|
+
if (index === -1)
|
|
90
|
+
index = 0;
|
|
91
|
+
cursor = cursor[fields.children][index];
|
|
92
|
+
columnIndex++;
|
|
93
|
+
formatted.push(options);
|
|
94
|
+
}
|
|
95
|
+
return formatted.slice();
|
|
96
|
+
};
|
|
97
|
+
const columnFieldNamesComputed = ({ props, computed }) => computed(() => {
|
|
98
|
+
return __spreadProps(__spreadValues({}, DEFAULT_FILED_NAMES), {
|
|
99
|
+
text: props.textField,
|
|
100
|
+
value: props.valueField,
|
|
101
|
+
children: props.childrenField
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
const defaultIndexes = ({ state, computed, columnFieldNames, columnsList }) => computed(() => {
|
|
105
|
+
const fields = columnFieldNames.value;
|
|
106
|
+
return columnsList.value.map((column, index) => {
|
|
107
|
+
const targetIndex = column.findIndex((item) => item[fields.value] === state.defaultValues[index]);
|
|
108
|
+
return targetIndex === -1 ? 0 : targetIndex;
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
const confirmDisabled = ({ props, state, columnsList }) => () => {
|
|
112
|
+
if (typeof props.disabled !== "function") {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
state.isDisabled = columnsList.value.some((column, columnIndex) => {
|
|
116
|
+
return props.disabled(state.defaultValues[columnIndex], ...state.defaultValues);
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
const change = ({ api, state, columnFieldNames, columnsList }) => () => {
|
|
120
|
+
if (api.isSameValue(state.oldValues, state.defaultValues))
|
|
121
|
+
return;
|
|
122
|
+
state.oldValues = state.defaultValues.slice();
|
|
123
|
+
if (state.isOldCascadeType) {
|
|
124
|
+
state.formattedColumns = api.createSourceData();
|
|
125
|
+
}
|
|
126
|
+
api.getColumnsList();
|
|
127
|
+
api.confirmDisabled();
|
|
128
|
+
const fields = columnFieldNames.value;
|
|
129
|
+
state.selectedOptions = columnsList.value.map((column, index) => {
|
|
130
|
+
return column.find((item) => item[fields.value] === state.defaultValues[index]) || column[0];
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const columnsTypeComputed = ({ state, computed, columnFieldNames }) => computed(() => {
|
|
134
|
+
const firstColumn = state.formattedColumns[0];
|
|
135
|
+
const fields = columnFieldNames.value;
|
|
136
|
+
if (firstColumn) {
|
|
137
|
+
if (Array.isArray(firstColumn)) {
|
|
138
|
+
return "multiple";
|
|
139
|
+
}
|
|
140
|
+
if (fields.children in firstColumn) {
|
|
141
|
+
return "cascade";
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return "single";
|
|
145
|
+
});
|
|
146
|
+
const getColumnsList = ({ state, api, columnsType, columnsList }) => () => {
|
|
147
|
+
let result = [];
|
|
148
|
+
switch (columnsType.value) {
|
|
149
|
+
case "multiple":
|
|
150
|
+
result = state.formattedColumns;
|
|
151
|
+
break;
|
|
152
|
+
case "cascade":
|
|
153
|
+
result = api.formatCascade(state.formattedColumns, state.defaultValues ? state.defaultValues : []);
|
|
154
|
+
break;
|
|
155
|
+
default:
|
|
156
|
+
result = [state.formattedColumns];
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
columnsList.value = result;
|
|
160
|
+
};
|
|
161
|
+
const setValue = ({ api, state }) => (value) => {
|
|
162
|
+
if (!api.isSameValue(value, state.defaultValues)) {
|
|
163
|
+
state.defaultValues = (value || []).slice();
|
|
164
|
+
api.change();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const isSameValue = (valA, valB) => JSON.stringify(valA) === JSON.stringify(valB);
|
|
168
|
+
const sliceValue = (min, max) => {
|
|
169
|
+
const values = [min];
|
|
170
|
+
Array.from({ length: max - min }).map((v, i) => values.push(min + i + 1));
|
|
171
|
+
return values;
|
|
172
|
+
};
|
|
173
|
+
const validArr = (arr) => Array.isArray(arr) && arr.length;
|
|
174
|
+
const validProps = ({ props }) => () => {
|
|
175
|
+
const { modelValue, options } = props;
|
|
176
|
+
return validArr(modelValue) && validArr(options) && modelValue.length === options.length;
|
|
177
|
+
};
|
|
178
|
+
const parseType = ({ props }) => (values) => {
|
|
179
|
+
const { valueType } = props;
|
|
180
|
+
return values.map(valueType === "number" ? Number : valueType === "string" ? String : (i) => i);
|
|
181
|
+
};
|
|
182
|
+
const init = ({ api, state }) => () => {
|
|
183
|
+
state.isInit = true;
|
|
184
|
+
state.formattedColumns = api.createSourceData();
|
|
185
|
+
api.getColumnsList();
|
|
186
|
+
};
|
|
187
|
+
const usePicker = (args) => {
|
|
188
|
+
const { ref, reactive, watch, computed, toRefs, props } = args;
|
|
189
|
+
const state = reactive({
|
|
190
|
+
formattedColumns: [],
|
|
191
|
+
defaultValues: [],
|
|
192
|
+
selectedOptions: [],
|
|
193
|
+
oldValues: [],
|
|
194
|
+
isOldCascadeType: false,
|
|
195
|
+
isDisabled: false,
|
|
196
|
+
isInit: false
|
|
197
|
+
});
|
|
198
|
+
const api = {};
|
|
199
|
+
const columnsList = ref([]);
|
|
200
|
+
const pickerColumn = ref([]);
|
|
201
|
+
const columnFieldNames = columnFieldNamesComputed({ props, computed });
|
|
202
|
+
const columnsType = columnsTypeComputed({ state, computed, columnFieldNames });
|
|
203
|
+
Object.assign(api, {
|
|
204
|
+
change: change({ api, state, columnFieldNames, columnsList }),
|
|
205
|
+
changeHandler: changeHandler({ state, columnFieldNames, columnsType, api }),
|
|
206
|
+
formatCascade: formatCascade({ columnFieldNames }),
|
|
207
|
+
setValue: setValue({ api, state }),
|
|
208
|
+
validProps: validProps({ props }),
|
|
209
|
+
parseType: parseType({ props }),
|
|
210
|
+
init: init({ api, state }),
|
|
211
|
+
isSameValue,
|
|
212
|
+
sliceValue,
|
|
213
|
+
getColumnsList: getColumnsList({ state, api, columnsType, columnsList }),
|
|
214
|
+
confirmDisabled: confirmDisabled({ props, state, columnsList }),
|
|
215
|
+
defaultIndexes: defaultIndexes({ state, computed, columnFieldNames, columnsList }),
|
|
216
|
+
createSourceData: createSourceData({ props, state, api })
|
|
217
|
+
});
|
|
218
|
+
initWatch({ props, api, state, watch });
|
|
219
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
220
|
+
columnsType,
|
|
221
|
+
columnsList,
|
|
222
|
+
columnFieldNames,
|
|
223
|
+
changeHandler: api.changeHandler,
|
|
224
|
+
defaultIndexes: api.defaultIndexes,
|
|
225
|
+
pickerColumn,
|
|
226
|
+
isSameValue: api.isSameValue,
|
|
227
|
+
setValue: api.setValue
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
const initWatch = ({ props, api, state, watch }) => {
|
|
231
|
+
watch(
|
|
232
|
+
() => props.modelValue,
|
|
233
|
+
(newValues) => {
|
|
234
|
+
api.setValue(newValues);
|
|
235
|
+
},
|
|
236
|
+
{ deep: true, immediate: true }
|
|
237
|
+
);
|
|
238
|
+
watch(
|
|
239
|
+
() => props.options,
|
|
240
|
+
() => props.visible && api.init(),
|
|
241
|
+
{ deep: true, immediate: true }
|
|
242
|
+
);
|
|
243
|
+
watch(
|
|
244
|
+
() => props.visible,
|
|
245
|
+
() => props.visible && !state.isInit && api.init(),
|
|
246
|
+
{ deep: true, immediate: true }
|
|
247
|
+
);
|
|
248
|
+
};
|
|
249
|
+
export {
|
|
250
|
+
usePicker
|
|
251
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const MIN_DISTANCE = 10;
|
|
3
|
+
const getDirection = (x, y) => {
|
|
4
|
+
if (x > y && x > MIN_DISTANCE)
|
|
5
|
+
return "horizontal";
|
|
6
|
+
if (y > x && y > MIN_DISTANCE)
|
|
7
|
+
return "vertical";
|
|
8
|
+
return "";
|
|
9
|
+
};
|
|
10
|
+
function useTouch({ ref }) {
|
|
11
|
+
const startX = ref(0);
|
|
12
|
+
const startY = ref(0);
|
|
13
|
+
const moveX = ref(0);
|
|
14
|
+
const moveY = ref(0);
|
|
15
|
+
const deltaX = ref(0);
|
|
16
|
+
const deltaY = ref(0);
|
|
17
|
+
const offsetX = ref(0);
|
|
18
|
+
const offsetY = ref(0);
|
|
19
|
+
const direction = ref("");
|
|
20
|
+
const isVertical = () => direction.value === "vertical";
|
|
21
|
+
const isHorizontal = () => direction.value === "horizontal";
|
|
22
|
+
const move = (event) => {
|
|
23
|
+
const touchEvent = event.touches[0];
|
|
24
|
+
deltaX.value = touchEvent.clientX - startX.value;
|
|
25
|
+
deltaY.value = touchEvent.clientY - startY.value;
|
|
26
|
+
moveY.value = touchEvent.clientY;
|
|
27
|
+
moveX.value = touchEvent.clientX;
|
|
28
|
+
offsetY.value = Math.abs(deltaY.value);
|
|
29
|
+
offsetX.value = Math.abs(deltaX.value);
|
|
30
|
+
if (!direction.value) {
|
|
31
|
+
direction.value = getDirection(offsetX.value, offsetY.value);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const reset = () => {
|
|
35
|
+
deltaX.value = 0;
|
|
36
|
+
offsetX.value = 0;
|
|
37
|
+
offsetY.value = 0;
|
|
38
|
+
deltaY.value = 0;
|
|
39
|
+
direction.value = "";
|
|
40
|
+
};
|
|
41
|
+
const start = (event) => {
|
|
42
|
+
reset();
|
|
43
|
+
startY.value = event.touches[0].clientY;
|
|
44
|
+
startX.value = event.touches[0].clientX;
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
start,
|
|
48
|
+
move,
|
|
49
|
+
reset,
|
|
50
|
+
startY,
|
|
51
|
+
startX,
|
|
52
|
+
moveY,
|
|
53
|
+
moveX,
|
|
54
|
+
deltaY,
|
|
55
|
+
deltaX,
|
|
56
|
+
offsetY,
|
|
57
|
+
offsetX,
|
|
58
|
+
isVertical,
|
|
59
|
+
direction,
|
|
60
|
+
isHorizontal
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
useTouch
|
|
65
|
+
};
|
package/cascader-select/vue.js
CHANGED
|
@@ -1,67 +1,55 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
handleTouchstart,
|
|
5
|
-
handleTouchend,
|
|
6
|
-
handleTouchmove,
|
|
7
|
-
watchActionSheetVisible,
|
|
8
|
-
calcSelector,
|
|
9
|
-
close,
|
|
10
|
-
confirm,
|
|
11
|
-
styleOpt,
|
|
12
|
-
statusOpt,
|
|
13
|
-
computedConfirmDisabled,
|
|
14
|
-
parseType
|
|
15
|
-
} from "./index";
|
|
16
|
-
import throttle from "../common/deps/throttle";
|
|
2
|
+
import { watchActionSheetVisible, close, confirm, columnStyle } from "./index";
|
|
3
|
+
import { usePicker } from "./usePicker";
|
|
17
4
|
const api = [
|
|
18
5
|
"state",
|
|
19
|
-
"handleTouchstart",
|
|
20
|
-
"handleTouchend",
|
|
21
|
-
"throttledHandleTouchmove",
|
|
22
6
|
"close",
|
|
23
7
|
"confirm",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
8
|
+
"columnsType",
|
|
9
|
+
"columnsList",
|
|
10
|
+
"columnFieldNames",
|
|
11
|
+
"changeHandler",
|
|
12
|
+
"defaultValues",
|
|
13
|
+
"isDisabled",
|
|
14
|
+
"selectedOptions",
|
|
15
|
+
"columnStyle"
|
|
26
16
|
];
|
|
27
|
-
const renderless = (props, { reactive, computed,
|
|
17
|
+
const renderless = (props, { reactive, computed, watch, ref, toRefs }, { emit, vm }) => {
|
|
28
18
|
const state = reactive({
|
|
29
19
|
actionSheetVisible: false,
|
|
30
|
-
|
|
31
|
-
selectorCount: 1,
|
|
32
|
-
selector0: {},
|
|
33
|
-
selector1: {},
|
|
34
|
-
selector2: {},
|
|
35
|
-
confirmDisabled: computed(() => api2.computedConfirmDisabled())
|
|
20
|
+
visibleOptionNum: 5
|
|
36
21
|
});
|
|
22
|
+
const {
|
|
23
|
+
changeHandler,
|
|
24
|
+
defaultValues,
|
|
25
|
+
columnsList,
|
|
26
|
+
columnsType,
|
|
27
|
+
columnFieldNames,
|
|
28
|
+
selectedOptions,
|
|
29
|
+
setValue,
|
|
30
|
+
isDisabled
|
|
31
|
+
} = usePicker({ ref, reactive, watch, computed, toRefs, props, emit });
|
|
37
32
|
const api2 = {
|
|
38
|
-
state
|
|
39
|
-
styleOpt,
|
|
40
|
-
statusOpt,
|
|
41
|
-
handleTouchstart: handleTouchstart(state),
|
|
42
|
-
handleTouchend: handleTouchend(state),
|
|
43
|
-
watchActionSheetVisible: watchActionSheetVisible({ emit, state, vm }),
|
|
44
|
-
close: close(state),
|
|
45
|
-
computedConfirmDisabled: computedConfirmDisabled(state),
|
|
46
|
-
parseType: parseType(props)
|
|
33
|
+
state
|
|
47
34
|
};
|
|
48
35
|
Object.assign(api2, {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
close: close(state),
|
|
37
|
+
confirm: confirm({ api: api2, emit, props, state, defaultValues, selectedOptions, isDisabled, vm }),
|
|
38
|
+
watchActionSheetVisible: watchActionSheetVisible({ emit, api: api2, props }),
|
|
39
|
+
columnsType,
|
|
40
|
+
columnsList,
|
|
41
|
+
columnFieldNames,
|
|
42
|
+
changeHandler,
|
|
43
|
+
defaultValues,
|
|
44
|
+
selectedOptions,
|
|
45
|
+
setValue,
|
|
46
|
+
isDisabled,
|
|
47
|
+
columnStyle: columnStyle({ props, computed })
|
|
56
48
|
});
|
|
57
49
|
watch(
|
|
58
50
|
() => props.visible,
|
|
59
51
|
(value) => state.actionSheetVisible = value
|
|
60
52
|
);
|
|
61
|
-
watch(
|
|
62
|
-
() => props.modelValue,
|
|
63
|
-
(value) => api2.init(value)
|
|
64
|
-
);
|
|
65
53
|
watch(
|
|
66
54
|
() => state.actionSheetVisible,
|
|
67
55
|
(value) => api2.watchActionSheetVisible(value)
|
package/cell/vue.js
CHANGED
|
@@ -3,7 +3,8 @@ const api = ["state"];
|
|
|
3
3
|
const renderless = (props, { reactive, computed, inject }, { parent }) => {
|
|
4
4
|
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
5
5
|
const state = reactive({
|
|
6
|
-
isDisplayOnly: computed(() => (parent.tinyForm || {}).displayOnly)
|
|
6
|
+
isDisplayOnly: computed(() => (parent.tinyForm || {}).displayOnly),
|
|
7
|
+
isDisabled: computed(() => props.disabled || (parent.tinyForm || {}).disabled)
|
|
7
8
|
});
|
|
8
9
|
const api2 = {
|
|
9
10
|
state
|
package/chart-bar/index.js
CHANGED
|
@@ -30,8 +30,7 @@ const getBarDimAxis = (args) => {
|
|
|
30
30
|
},
|
|
31
31
|
show: axisVisible,
|
|
32
32
|
axisTick: { show: true, alignWithLabel: true, lineStyle: { color: "#191919", opacity: 0.1, width: 2 } },
|
|
33
|
-
axisLine: { show: true, lineStyle: { color: "#191919", opacity: 0.1, width: 2 } }
|
|
34
|
-
axisPointer: { type: "shadow", z: 1, shadowStyle: { color: "#f5f5f5" } }
|
|
33
|
+
axisLine: { show: true, lineStyle: { color: "#191919", opacity: 0.1, width: 2 } }
|
|
35
34
|
}));
|
|
36
35
|
};
|
|
37
36
|
const factoryFmt = ({ meaAxisType, i, digit }) => (val) => getFormated(val, meaAxisType[i], digit);
|
|
@@ -74,7 +73,7 @@ const getBarTooltip = (args) => {
|
|
|
74
73
|
});
|
|
75
74
|
return tplt.join("");
|
|
76
75
|
};
|
|
77
|
-
return { trigger: "axis", formatter };
|
|
76
|
+
return { trigger: "axis", formatter, axisPointer: { type: "shadow", z: 1, shadowStyle: { color: "#f5f5f5" } } };
|
|
78
77
|
};
|
|
79
78
|
const getValueData = (seriesTemp, dims) => {
|
|
80
79
|
const max = Math.max(...dims);
|
|
@@ -1,47 +1,29 @@
|
|
|
1
1
|
import "../../chunk-G2ADBYYC.js";
|
|
2
|
-
const
|
|
2
|
+
const SF = () => ({ show: false });
|
|
3
3
|
const DEFAULT_THEME = {
|
|
4
|
-
categoryAxis: { axisLine:
|
|
5
|
-
valueAxis: { axisLine:
|
|
4
|
+
categoryAxis: { axisLine: SF(), axisTick: SF(), splitLine: SF() },
|
|
5
|
+
valueAxis: { axisLine: SF() },
|
|
6
6
|
line: { smooth: true },
|
|
7
7
|
grid: { containLabel: true, left: 10, right: 10 }
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const DEFAULT_COLORS = [
|
|
10
|
+
"#19d4ae",
|
|
11
|
+
"#5ab1ef",
|
|
12
|
+
"#fa6e86",
|
|
13
|
+
"#ffb980",
|
|
14
|
+
"#0067a6",
|
|
15
|
+
"#c4b4e4",
|
|
16
|
+
"#d87a80",
|
|
17
|
+
"#9cbbff",
|
|
18
|
+
"#d9d0c7",
|
|
19
|
+
"#87a997",
|
|
20
|
+
"#d49ea2",
|
|
21
|
+
"#5b4947",
|
|
22
|
+
"#7ba3a8"
|
|
23
|
+
];
|
|
11
24
|
const HEAT_MAP_COLOR = ["#5990FD", "#2DA769", "#EEBA18", "#F43146"];
|
|
12
25
|
const HEAT_BMAP_COLOR = ["blue", "blue", "green", "yellow", "red"];
|
|
13
|
-
const
|
|
14
|
-
"#6d8ff0",
|
|
15
|
-
"#00a874",
|
|
16
|
-
"#bd72f0",
|
|
17
|
-
"#54bcce",
|
|
18
|
-
"#fdc000",
|
|
19
|
-
"#9185f0",
|
|
20
|
-
"#82dbb1",
|
|
21
|
-
"#f46087",
|
|
22
|
-
"#2070f3",
|
|
23
|
-
"#ee8ddb"
|
|
24
|
-
];
|
|
25
|
-
const SAAS_DEFAULT_COLORS_18 = [
|
|
26
|
-
"#2070f3",
|
|
27
|
-
"#50c291",
|
|
28
|
-
"#bd72f0",
|
|
29
|
-
"#54bcce",
|
|
30
|
-
"#fdc000",
|
|
31
|
-
"#6d8ff0",
|
|
32
|
-
"#71c14c",
|
|
33
|
-
"#87d5e5",
|
|
34
|
-
"#9185f0",
|
|
35
|
-
"#82dbb1",
|
|
36
|
-
"#ada6ed",
|
|
37
|
-
"#97da7e",
|
|
38
|
-
"#f46087",
|
|
39
|
-
"#ee8ddb",
|
|
40
|
-
"#f09596",
|
|
41
|
-
"#f36900",
|
|
42
|
-
"#daa61b",
|
|
43
|
-
"#efb9e3"
|
|
44
|
-
];
|
|
26
|
+
const HEAT_DEFAULT_COLOR = ["#fff", "#6D8FF0"];
|
|
45
27
|
const _SAAS_DEFAULT_COLORS1 = ["#2070F3", "#55CCD9", "#715AF8", "#8AC8F3", "#EB74DF", "#87C859", "#D19F00"];
|
|
46
28
|
const _SAAS_DEFAULT_COLORS2 = ["#36C18D", "#CB8EFB", "#ED448A", "#F7C45C", "#E7434A", "#2A8290", "#EE8DDB"];
|
|
47
29
|
const _SAAS_DEFAULT_COLORS3 = ["#278661", "#4FA700", "#5CACFF", "#9185F0", "#B62BF7", "#26616B", "#F46465"];
|
|
@@ -108,21 +90,39 @@ const itemLabel = (seriesName, onlyLabel) => [
|
|
|
108
90
|
`${onlyLabel ? "" : "margin-right:25px;"}`,
|
|
109
91
|
`">${seriesName}</span>`
|
|
110
92
|
].join("");
|
|
111
|
-
const itemContent = (content) =>
|
|
93
|
+
const itemContent = (content) => {
|
|
94
|
+
return ['<span style="', `float:right;`, `font-size:14px;`, `color:#191919;`, `">${content}</span>`].join("");
|
|
95
|
+
};
|
|
112
96
|
const STATIC_PROPS = ["initOptions", "loading", "dataEmpty", "judgeWidth", "widthChangeDelay"];
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
97
|
+
const ECHARTS_SETTINGS = [
|
|
98
|
+
"grid",
|
|
99
|
+
"dataZoom",
|
|
100
|
+
"visualMap",
|
|
101
|
+
"toolbox",
|
|
102
|
+
"title",
|
|
103
|
+
"legend",
|
|
104
|
+
"xAxis",
|
|
105
|
+
"yAxis",
|
|
106
|
+
"radar",
|
|
107
|
+
"tooltip",
|
|
108
|
+
"axisPointer",
|
|
109
|
+
"brush",
|
|
110
|
+
"geo",
|
|
111
|
+
"timeline",
|
|
112
|
+
"graphic",
|
|
113
|
+
"series",
|
|
114
|
+
"backgroundColor",
|
|
115
|
+
"textStyle"
|
|
116
|
+
];
|
|
116
117
|
export {
|
|
117
118
|
DEFAULT_COLORS,
|
|
118
119
|
DEFAULT_CONFIG,
|
|
119
120
|
DEFAULT_THEME,
|
|
120
121
|
ECHARTS_SETTINGS,
|
|
121
122
|
HEAT_BMAP_COLOR,
|
|
123
|
+
HEAT_DEFAULT_COLOR,
|
|
122
124
|
HEAT_MAP_COLOR,
|
|
123
125
|
SAAS_DEFAULT_COLORS,
|
|
124
|
-
SAAS_DEFAULT_COLORS_10,
|
|
125
|
-
SAAS_DEFAULT_COLORS_18,
|
|
126
126
|
SAAS_DEFAULT_SAME_COLORS,
|
|
127
127
|
STATIC_PROPS,
|
|
128
128
|
itemContent,
|
package/chart-core/index.js
CHANGED
|
@@ -127,7 +127,7 @@ const dataHandler = ({ api, props, state, echartsLib, t, vm }) => () => {
|
|
|
127
127
|
if (props.beforeConfig) {
|
|
128
128
|
data = props.beforeConfig(data);
|
|
129
129
|
}
|
|
130
|
-
let options = api.chartHandler(columns, rows, props.settings, extra);
|
|
130
|
+
let options = api.chartHandler(columns, rows, props.settings, extra, props.extend);
|
|
131
131
|
if (options) {
|
|
132
132
|
if (typeof options.then === "function") {
|
|
133
133
|
options.then(api.optionsHandler);
|
package/chart-gauge/index.js
CHANGED
|
@@ -52,10 +52,10 @@ function getSeries(args) {
|
|
|
52
52
|
axisLabel: { formatter: formatter2 },
|
|
53
53
|
itemStyle: { color: "#6D8FF0" },
|
|
54
54
|
pointer: getPoint(),
|
|
55
|
-
axisLine: { roundCap: true },
|
|
55
|
+
axisLine: { roundCap: true, lineStyle: { width: 8, color: [[1, "rgba(25,25,25,0.1)"]] } },
|
|
56
56
|
progress: { show: true, roundCap: true, width: 8, color: "#6D8FF0" },
|
|
57
57
|
axisTick: { show: false },
|
|
58
|
-
splitLine: { length: 8, distance: 0, lineStyle: { width: 1, color: "rgba(25,25,25,0.
|
|
58
|
+
splitLine: { length: 8, distance: 0, lineStyle: { width: 1, color: "rgba(25,25,25,0.1)" } },
|
|
59
59
|
title: { offsetCenter: [0, "25%"], color: "#191919", fontSize: 14 }
|
|
60
60
|
};
|
|
61
61
|
if (seriesItem) {
|
package/chart-heatmap/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__spreadValues
|
|
3
3
|
} from "../chunk-G2ADBYYC.js";
|
|
4
4
|
import { getFormated, getBmap, getAmap, getMapJSON } from "../chart-core/deps/utils";
|
|
5
|
-
import { HEAT_MAP_COLOR, itemPoint, itemLabel, itemContent } from "../chart-core/deps/constants";
|
|
5
|
+
import { HEAT_MAP_COLOR, HEAT_DEFAULT_COLOR, itemPoint, itemLabel, itemContent } from "../chart-core/deps/constants";
|
|
6
6
|
const getAxisList = (rows, label) => {
|
|
7
7
|
const result = [];
|
|
8
8
|
rows.forEach((row) => !result.includes(row[label]) && result.push(row[label]));
|
|
@@ -20,7 +20,7 @@ const getData = (args) => {
|
|
|
20
20
|
xIndex = innerXAxisList.indexOf(row[xDim]);
|
|
21
21
|
extra = extraMetrics.map((m) => row[m] || "-");
|
|
22
22
|
value = metrics ? row[metrics] : 1;
|
|
23
|
-
return { value: [xIndex, yIndex, value].concat(extra)
|
|
23
|
+
return { value: [xIndex, yIndex, value].concat(extra) };
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
return result;
|
|
@@ -37,7 +37,7 @@ let getAxis = (list, name, type) => ({
|
|
|
37
37
|
zlevel: 1
|
|
38
38
|
});
|
|
39
39
|
const getVisualMap = (args) => {
|
|
40
|
-
const { innerMin: min, innerMax: max, type, heatColor, series } = args;
|
|
40
|
+
const { innerMin: min, innerMax: max, type, heatColor, series, visualMapConfig } = args;
|
|
41
41
|
let { extra } = {};
|
|
42
42
|
if (type === "map") {
|
|
43
43
|
extra = {};
|
|
@@ -47,8 +47,9 @@ const getVisualMap = (args) => {
|
|
|
47
47
|
} else {
|
|
48
48
|
extra = { dimension: 2 };
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const visualMapColor = visualMapConfig && visualMapConfig.color;
|
|
51
|
+
const defaultColor = type === "map" || type === "bmap" || type === "amap" ? HEAT_MAP_COLOR : visualMapColor || HEAT_DEFAULT_COLOR;
|
|
52
|
+
let result = Object.assign(extra, {
|
|
52
53
|
min,
|
|
53
54
|
max,
|
|
54
55
|
calculable: true,
|
|
@@ -57,11 +58,16 @@ const getVisualMap = (args) => {
|
|
|
57
58
|
orient: "vertical",
|
|
58
59
|
align: "left",
|
|
59
60
|
borderColor: "#6D8FF0",
|
|
60
|
-
inverse: true
|
|
61
|
-
inRange: { color: heatColor || defaultColor }
|
|
61
|
+
inverse: true
|
|
62
62
|
});
|
|
63
|
+
if (type !== "cartesian" || !visualMapColor) {
|
|
64
|
+
Object.assign(result, {
|
|
65
|
+
inRange: { color: heatColor || defaultColor }
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return Object.assign(result, visualMapConfig);
|
|
63
69
|
};
|
|
64
|
-
const getSeries = (args) => [{ type: "heatmap", data: args.chartData }];
|
|
70
|
+
const getSeries = (args) => [{ type: "heatmap", data: args.chartData, label: { show: true, color: "#191919" } }];
|
|
65
71
|
const getTooltip = (args) => {
|
|
66
72
|
const { dataType, innerXAxisList, innerYAxisList, digit, extraMetrics, metrics } = args;
|
|
67
73
|
function formatter({ color, data }) {
|
|
@@ -123,7 +129,7 @@ const getResult = (args) => {
|
|
|
123
129
|
}
|
|
124
130
|
return res;
|
|
125
131
|
};
|
|
126
|
-
const heatmap = (columns, rows, settings, extra) => {
|
|
132
|
+
const heatmap = (columns, rows, settings, extra, extend) => {
|
|
127
133
|
const { type = "cartesian" } = settings;
|
|
128
134
|
const { dimension = [columns[0], columns[1]] } = settings;
|
|
129
135
|
const { dataType = "normal", min, max, digit, bmap, amap, geo, key, v = "2.0", url } = settings;
|
|
@@ -131,6 +137,7 @@ const heatmap = (columns, rows, settings, extra) => {
|
|
|
131
137
|
const { heatColor, yAxisName, xAxisName, beforeRegisterMapOnce, specialAreas = {} } = settings;
|
|
132
138
|
const { metrics = columns[2], mapURLProfix = "https://unpkg.com/echarts@3.6.2/map/json/" } = settings;
|
|
133
139
|
const { tooltipVisible, echartsLib: echarts } = extra;
|
|
140
|
+
const visualMapConfig = extend && extend.visualMap;
|
|
134
141
|
let { xAxisList: innerXAxisList, yAxisList: innerYAxisList } = settings;
|
|
135
142
|
let { chartData = [], extraMetrics = [], mainColumn = dimension.concat([metrics]) } = {};
|
|
136
143
|
columns.forEach((column) => !~mainColumn.indexOf(column) && extraMetrics.push(column));
|
|
@@ -145,7 +152,7 @@ const heatmap = (columns, rows, settings, extra) => {
|
|
|
145
152
|
const xAxis = getAxis(innerXAxisList, xAxisName, "x");
|
|
146
153
|
const yAxis = getAxis(innerYAxisList, yAxisName, "y");
|
|
147
154
|
const series = getSeries({ chartData });
|
|
148
|
-
const visualMap = getVisualMap({ innerMin, innerMax, type, heatColor, series });
|
|
155
|
+
const visualMap = getVisualMap({ innerMin, innerMax, type, heatColor, series, visualMapConfig });
|
|
149
156
|
const tooltipParams = { dataType, innerXAxisList, innerYAxisList, digit, extraMetrics, metrics };
|
|
150
157
|
const tooltip = tooltipVisible && getTooltip(tooltipParams);
|
|
151
158
|
const options = { visualMap, series, grid: { left: 25, right: 80, width: "auto", height: "auto" } };
|