@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
package/form-item/index.js
CHANGED
|
@@ -42,7 +42,7 @@ const computedLabelStyle = ({ props, state }) => () => {
|
|
|
42
42
|
if (state.form.labelPosition === POSITION.Top) {
|
|
43
43
|
return result;
|
|
44
44
|
}
|
|
45
|
-
const labelWidth = props.labelWidth || state.form.labelWidth;
|
|
45
|
+
const labelWidth = props.labelWidth || state.form.state.labelWidth;
|
|
46
46
|
if (labelWidth) {
|
|
47
47
|
result.width = labelWidth;
|
|
48
48
|
}
|
|
@@ -54,7 +54,7 @@ const computedValueStyle = ({ props, state }) => () => {
|
|
|
54
54
|
result.width = "100%";
|
|
55
55
|
return result;
|
|
56
56
|
}
|
|
57
|
-
const labelWidth = props.labelWidth || state.form.labelWidth;
|
|
57
|
+
const labelWidth = props.labelWidth || state.form.state.labelWidth;
|
|
58
58
|
if (labelWidth) {
|
|
59
59
|
if (labelWidth === "auto") {
|
|
60
60
|
result.width = labelWidth;
|
|
@@ -73,11 +73,11 @@ const computedContentStyle = ({ props, state }) => () => {
|
|
|
73
73
|
if (!label && !props.labelWidth && state.isNested) {
|
|
74
74
|
return result;
|
|
75
75
|
}
|
|
76
|
-
const labelWidth = props.labelWidth || state.form.labelWidth;
|
|
76
|
+
const labelWidth = props.labelWidth || state.form.state.labelWidth;
|
|
77
77
|
if (labelWidth === "auto") {
|
|
78
78
|
if (props.labelWidth === "auto") {
|
|
79
79
|
result.marginLeft = state.computedLabelWidth;
|
|
80
|
-
} else if (state.form.labelWidth === "auto") {
|
|
80
|
+
} else if (state.form.state.labelWidth === "auto") {
|
|
81
81
|
result.marginLeft = state.formInstance.state.autoLabelWidth;
|
|
82
82
|
}
|
|
83
83
|
} else {
|
|
@@ -235,7 +235,7 @@ const resetField = ({ api, nextTick, props, state }) => () => {
|
|
|
235
235
|
const getRules = ({ props, state }) => () => {
|
|
236
236
|
let formRules = state.form.rules || {};
|
|
237
237
|
const selfRules = props.rules;
|
|
238
|
-
const requiredRule = props.required !== void 0 ? { required:
|
|
238
|
+
const requiredRule = props.required !== void 0 ? { required: Boolean(props.required) } : [];
|
|
239
239
|
const prop = getPropByPath(formRules, props.prop || "");
|
|
240
240
|
formRules = formRules ? prop.o[props.prop || ""] || prop.v : [];
|
|
241
241
|
return [].concat(selfRules || formRules || []).concat(requiredRule);
|
package/form-item/vue.js
CHANGED
|
@@ -97,7 +97,9 @@ const initState = ({
|
|
|
97
97
|
getValidateType: computed(() => api2.computedGetValidateType()),
|
|
98
98
|
validateIcon: computed(() => api2.computedValidateIcon()),
|
|
99
99
|
isErrorInline: computed(() => api2.computedIsErrorInline()),
|
|
100
|
-
isErrorBlock: computed(() => api2.computedIsErrorBlock())
|
|
100
|
+
isErrorBlock: computed(() => api2.computedIsErrorBlock()),
|
|
101
|
+
disabled: computed(() => state.formInstance.disabled),
|
|
102
|
+
tooltipType: computed(() => state.formInstance.state.tooltipType)
|
|
101
103
|
});
|
|
102
104
|
return state;
|
|
103
105
|
};
|
package/fullscreen/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const request = ({ props, state, vm, sf, api }) => () => {
|
|
|
15
15
|
const change = () => {
|
|
16
16
|
if (state.isPageOnly) {
|
|
17
17
|
state.isFullscreen = true;
|
|
18
|
-
api.
|
|
18
|
+
api.onChangeFullScreen();
|
|
19
19
|
off(document, "keyup", api.keypressCallback);
|
|
20
20
|
on(document, "keyup", api.keypressCallback);
|
|
21
21
|
} else {
|
|
@@ -42,7 +42,7 @@ const exit = ({ state, api, sf, props }) => () => {
|
|
|
42
42
|
}
|
|
43
43
|
if (state.isPageOnly) {
|
|
44
44
|
state.isFullscreen = false;
|
|
45
|
-
api.
|
|
45
|
+
api.onChangeFullScreen();
|
|
46
46
|
off(document, "keyup", api.keypressCallback);
|
|
47
47
|
} else {
|
|
48
48
|
sf.exit();
|
|
@@ -62,14 +62,14 @@ const fullScreenCallback = ({ state, sf, api }) => () => {
|
|
|
62
62
|
sf.off("change", api.fullScreenCallback);
|
|
63
63
|
}
|
|
64
64
|
state.isFullscreen = sf.isFullscreen;
|
|
65
|
-
api.
|
|
65
|
+
api.onChangeFullScreen();
|
|
66
66
|
};
|
|
67
67
|
const keypressCallback = (api) => (e) => {
|
|
68
68
|
if (e.key === "Escape") {
|
|
69
69
|
api.exit();
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
const
|
|
72
|
+
const onChangeFullScreen = ({ props, state, vm, emit }) => () => {
|
|
73
73
|
if (!state.isFullscreen) {
|
|
74
74
|
if (props.teleport && state.__parentNode) {
|
|
75
75
|
state.__parentNode.insertBefore(vm.$el, state.__token);
|
|
@@ -106,7 +106,7 @@ export {
|
|
|
106
106
|
fullScreenCallback,
|
|
107
107
|
getState,
|
|
108
108
|
keypressCallback,
|
|
109
|
-
|
|
109
|
+
onChangeFullScreen,
|
|
110
110
|
request,
|
|
111
111
|
shadeClick,
|
|
112
112
|
toggle
|
package/fullscreen/vue.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
shadeClick,
|
|
10
10
|
keypressCallback,
|
|
11
11
|
fullScreenCallback,
|
|
12
|
-
|
|
12
|
+
onChangeFullScreen,
|
|
13
13
|
computeWrapperStyle
|
|
14
14
|
} from "./index";
|
|
15
15
|
const api = [
|
|
@@ -22,7 +22,7 @@ const api = [
|
|
|
22
22
|
"shadeClick",
|
|
23
23
|
"keypressCallback",
|
|
24
24
|
"fullScreenCallback",
|
|
25
|
-
"
|
|
25
|
+
"onChangeFullScreen"
|
|
26
26
|
];
|
|
27
27
|
const renderless = (props, { reactive, computed, watch }, { vm, emit }) => {
|
|
28
28
|
const api2 = {};
|
|
@@ -45,7 +45,7 @@ const renderless = (props, { reactive, computed, watch }, { vm, emit }) => {
|
|
|
45
45
|
request: request({ props, state, vm, sf, api: api2 }),
|
|
46
46
|
fullScreenCallback: fullScreenCallback({ state, sf, api: api2 }),
|
|
47
47
|
computeWrapperStyle: computeWrapperStyle({ props, state }),
|
|
48
|
-
|
|
48
|
+
onChangeFullScreen: onChangeFullScreen({ props, state, vm, emit })
|
|
49
49
|
});
|
|
50
50
|
watch(
|
|
51
51
|
() => props.fullscreen,
|
package/grid/plugins/export.js
CHANGED
|
@@ -37,11 +37,14 @@ const getCsvContent = ($table, opts, oColumns, oData) => {
|
|
|
37
37
|
const tableEl = $table.$el;
|
|
38
38
|
const tab = opts.useTabs === false ? "" : " ";
|
|
39
39
|
const { columns, datas } = getCsvData(opts, oData, oColumns, tableEl);
|
|
40
|
-
let content =
|
|
40
|
+
let content = "\uFEFF";
|
|
41
41
|
const transfrom = (str) => {
|
|
42
42
|
if (typeof str === "string" && str.replace(/ /g, "").match(/[\s,"]/)) {
|
|
43
43
|
str = '"' + str.replace(/"/g, '""') + '"';
|
|
44
44
|
}
|
|
45
|
+
if (typeof str === "string" && str.match(/^([@=]|([-\\+].*[^0-9\\.])).*$/)) {
|
|
46
|
+
str = " " + str;
|
|
47
|
+
}
|
|
45
48
|
return str + tab;
|
|
46
49
|
};
|
|
47
50
|
if (opts.isHeader) {
|
|
@@ -71,7 +74,7 @@ const getCsvContent = ($table, opts, oColumns, oData) => {
|
|
|
71
74
|
};
|
|
72
75
|
const getCsvUrl = (opts, content) => {
|
|
73
76
|
if (window.Blob && window.URL && window.URL.createObjectURL && browser.name !== "safari") {
|
|
74
|
-
return URL.createObjectURL(new Blob([content], { type: "text/csv" }));
|
|
77
|
+
return URL.createObjectURL(new Blob([content], { type: "text/csv;charset=utf-8" }));
|
|
75
78
|
}
|
|
76
79
|
return `data:attachment/csv;charset=utf-8,${encodeURIComponent(content)}`;
|
|
77
80
|
};
|
package/grid/utils/column.js
CHANGED
|
@@ -41,6 +41,7 @@ function setBasicProperty(column, context) {
|
|
|
41
41
|
column.renderer = context.renderer;
|
|
42
42
|
column.editor = context.editor;
|
|
43
43
|
column.operationConfig = context.operationConfig;
|
|
44
|
+
column.equals = context.equals;
|
|
44
45
|
}
|
|
45
46
|
function ColumnConfig(context, { renderHeader, renderCell, renderData } = {}, config = {}) {
|
|
46
47
|
setBasicProperty(this, context);
|
package/grid/utils/dom.js
CHANGED
|
@@ -96,11 +96,16 @@ const colToVisible = ($table, column, move) => {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
|
+
const hasDataTag = (el, value) => {
|
|
100
|
+
if (!el || !value)
|
|
101
|
+
return false;
|
|
102
|
+
return (" " + el.getAttribute("data-tag") + " ").includes(" " + value + " ");
|
|
103
|
+
};
|
|
99
104
|
const getEventTargetNode = (event, container, queryCls) => {
|
|
100
105
|
let targetEl;
|
|
101
106
|
let target = getActualTarget(event);
|
|
102
107
|
while (target && target.nodeType && target !== document) {
|
|
103
|
-
if (queryCls && hasClass(target, queryCls)) {
|
|
108
|
+
if (queryCls && (hasClass(target, queryCls) || hasDataTag(target, queryCls))) {
|
|
104
109
|
targetEl = target;
|
|
105
110
|
} else if (target === container) {
|
|
106
111
|
return {
|
|
@@ -188,6 +193,7 @@ export {
|
|
|
188
193
|
getEventTargetNode,
|
|
189
194
|
getOffsetPos,
|
|
190
195
|
getRowNodes,
|
|
196
|
+
hasDataTag,
|
|
191
197
|
isPx,
|
|
192
198
|
isScale,
|
|
193
199
|
rowToVisible,
|
package/image/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import { on, off, getScrollContainer, isInContainer } from "../common/deps/dom";
|
|
3
3
|
import { typeOf } from "../common/type";
|
|
4
|
-
import "../common/deps/requestAnimationFrame";
|
|
5
4
|
import { rafThrottle } from "../image-viewer";
|
|
5
|
+
import { xss } from "../common/xss";
|
|
6
6
|
const isSupportObjectFit = () => document.documentElement.style.objectFit !== void 0;
|
|
7
7
|
const isHtmlElement = (node) => node && node.nodeType === Node.ELEMENT_NODE;
|
|
8
8
|
const computedGetImageStyle = ({ props, api }) => () => {
|
|
@@ -108,6 +108,10 @@ const mounted = ({ props, api }) => () => {
|
|
|
108
108
|
api.loadImage();
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
+
const filterImageUrl = (props) => () => {
|
|
112
|
+
const isBase64 = /^data:image\/(png|jpg|jpeg|gif);base64,([a-zA-Z0-9+/]+={0,2})/;
|
|
113
|
+
return isBase64.test(props.src) ? props.src : xss.filterUrl(props.src);
|
|
114
|
+
};
|
|
111
115
|
export {
|
|
112
116
|
addLazyLoadListener,
|
|
113
117
|
clickHandler,
|
|
@@ -116,6 +120,7 @@ export {
|
|
|
116
120
|
computedGetImageStyle,
|
|
117
121
|
computedGetPreview,
|
|
118
122
|
deleteHander,
|
|
123
|
+
filterImageUrl,
|
|
119
124
|
getImageStyle,
|
|
120
125
|
handleError,
|
|
121
126
|
handleLazyLoad,
|
package/image/vue.js
CHANGED
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
clickHandler,
|
|
14
14
|
closeViewer,
|
|
15
15
|
mounted,
|
|
16
|
-
deleteHander
|
|
16
|
+
deleteHander,
|
|
17
|
+
filterImageUrl
|
|
17
18
|
} from "./index";
|
|
18
19
|
const api = [
|
|
19
20
|
"state",
|
|
@@ -46,7 +47,8 @@ const initState = ({
|
|
|
46
47
|
showViewer: false,
|
|
47
48
|
getPreview: computed(() => api2.computedGetPreview()),
|
|
48
49
|
getImageStyle: computed(() => api2.computedGetImageStyle()),
|
|
49
|
-
getAlignCenter: computed(() => api2.computedGetAlignCenter())
|
|
50
|
+
getAlignCenter: computed(() => api2.computedGetAlignCenter()),
|
|
51
|
+
src: computed(() => api2.filterImageUrl())
|
|
50
52
|
});
|
|
51
53
|
return state;
|
|
52
54
|
};
|
|
@@ -75,7 +77,8 @@ const initApi = ({
|
|
|
75
77
|
loadImage: loadImage({ api: api2, state, props, attrs }),
|
|
76
78
|
computedGetImageStyle: computedGetImageStyle({ api: api2, props }),
|
|
77
79
|
addLazyLoadListener: addLazyLoadListener({ api: api2, props, state, vm }),
|
|
78
|
-
deleteHander: deleteHander(emit)
|
|
80
|
+
deleteHander: deleteHander(emit),
|
|
81
|
+
filterImageUrl: filterImageUrl(props)
|
|
79
82
|
});
|
|
80
83
|
};
|
|
81
84
|
const initWatch = ({ watch, state, api: api2, props }) => {
|
package/image-viewer/index.js
CHANGED
|
@@ -27,14 +27,11 @@ const hide = ({ props, api, state }) => () => {
|
|
|
27
27
|
};
|
|
28
28
|
const deviceSupportInstall = ({ state, api, mode }) => () => {
|
|
29
29
|
on(window, "resize", api.initPage);
|
|
30
|
-
state.urlList = state.urlList.map((subItem) => {
|
|
31
|
-
return xss.filterUrl(subItem);
|
|
32
|
-
});
|
|
33
30
|
state.urlList = state.urlList.map((subItem) => {
|
|
34
31
|
let subItemObj = {};
|
|
35
32
|
let lastSlashIndex = "";
|
|
36
33
|
if (typeof subItem === "string") {
|
|
37
|
-
subItem =
|
|
34
|
+
subItem = api.filterImageUrl(subItem);
|
|
38
35
|
if (state.isThumbnail || state.isMenuView) {
|
|
39
36
|
lastSlashIndex = subItem.lastIndexOf("/");
|
|
40
37
|
state.fileName = subItem.substring(lastSlashIndex + 1);
|
|
@@ -47,12 +44,15 @@ const deviceSupportInstall = ({ state, api, mode }) => () => {
|
|
|
47
44
|
return { url: subItem, name: state.fileName };
|
|
48
45
|
}
|
|
49
46
|
} else if (typeof subItem === "object" && subItem !== null) {
|
|
47
|
+
subItem.url = api.filterImageUrl(subItem.url);
|
|
50
48
|
if (!subItem.name) {
|
|
51
49
|
lastSlashIndex = subItem.url.lastIndexOf("/");
|
|
52
50
|
state.fileName = subItem.url.substring(lastSlashIndex + 1);
|
|
53
51
|
subItem.name = state.fileName;
|
|
54
52
|
}
|
|
55
53
|
return subItem;
|
|
54
|
+
} else {
|
|
55
|
+
return null;
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
state._keyDownHandler = rafThrottle((event) => {
|
|
@@ -173,23 +173,17 @@ const prev = ({ state, api, vm }) => () => {
|
|
|
173
173
|
} else if (state.isMenuView) {
|
|
174
174
|
prevElement = vm.$refs[`isMenuView_${state.index}`][0] || vm.$refs[`isMenuView_${state.index}`];
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
case state.urlList.length - 3:
|
|
188
|
-
state.scrollTop = prevElement.offsetHeight;
|
|
189
|
-
break;
|
|
190
|
-
default:
|
|
191
|
-
api.getDefaultPrev(prevElement);
|
|
192
|
-
break;
|
|
176
|
+
if (state.index === 1) {
|
|
177
|
+
state.isThumbnail && vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = 0);
|
|
178
|
+
state.isMenuView && vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = 0);
|
|
179
|
+
state.scrollTop = 0;
|
|
180
|
+
} else if (state.index === state.urlList.length - 1) {
|
|
181
|
+
api.getLastPrev(prevElement);
|
|
182
|
+
} else if (state.index === state.urlList.length - 2) {
|
|
183
|
+
} else if (state.index === state.urlList.length - 3) {
|
|
184
|
+
state.scrollTop = prevElement.offsetHeight;
|
|
185
|
+
} else {
|
|
186
|
+
api.getDefaultPrev(prevElement);
|
|
193
187
|
}
|
|
194
188
|
};
|
|
195
189
|
const getLastPrev = ({ state, vm }) => (prevElement) => {
|
|
@@ -219,30 +213,37 @@ const next = ({ state, api, vm }) => () => {
|
|
|
219
213
|
} else if (state.isMenuView) {
|
|
220
214
|
element = vm.$refs[`isMenuView_${state.index}`][0] || vm.$refs[`isMenuView_${state.index}`];
|
|
221
215
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
state.scrollTop =
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
216
|
+
state.centerIndex = api.getCenterPosition(element) - 1;
|
|
217
|
+
let slientIndex = -1;
|
|
218
|
+
if (state.centerIndex > state.index) {
|
|
219
|
+
slientIndex = state.index;
|
|
220
|
+
}
|
|
221
|
+
if (state.index === 0) {
|
|
222
|
+
state.isThumbnail && vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = 0);
|
|
223
|
+
state.isMenuView && vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = 0);
|
|
224
|
+
state.scrollTop = 0;
|
|
225
|
+
} else if (state.index === slientIndex) {
|
|
226
|
+
} else {
|
|
227
|
+
if (state.isThumbnail) {
|
|
228
|
+
vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = state.scrollTop);
|
|
229
|
+
state.scrollTop = state.scrollTop + element.offsetHeight + state.thumbnailTop;
|
|
230
|
+
} else if (state.isMenuView) {
|
|
231
|
+
vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = state.scrollTop);
|
|
232
|
+
state.scrollTop = state.scrollTop + element.offsetHeight + state.menuTop;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const getCenterPosition = ({ state, vm }) => (element) => {
|
|
237
|
+
let contentHeight = 0;
|
|
238
|
+
let eleHeight = 0;
|
|
239
|
+
if (state.isThumbnail && vm.$refs.isThumbnailContent) {
|
|
240
|
+
contentHeight = vm.$refs.isThumbnailContent.getBoundingClientRect().height;
|
|
241
|
+
eleHeight = element.getBoundingClientRect().height + parseFloat(getComputedStyle(element).marginBottom) - 0;
|
|
242
|
+
return Math.ceil(contentHeight / eleHeight) / 2;
|
|
243
|
+
} else if (vm.$refs.isMenuViewContent && vm.$refs.isMenuViewContent) {
|
|
244
|
+
contentHeight = vm.$refs.isMenuViewContent.getBoundingClientRect().height;
|
|
245
|
+
eleHeight = element.getBoundingClientRect().height + parseFloat(getComputedStyle(element).marginTop) - 0;
|
|
246
|
+
return Math.ceil(contentHeight / eleHeight) / 2;
|
|
246
247
|
}
|
|
247
248
|
};
|
|
248
249
|
const handleActions = (state, props, emit) => (action, options = {}) => {
|
|
@@ -295,11 +296,11 @@ const handleActions = (state, props, emit) => (action, options = {}) => {
|
|
|
295
296
|
const computedIsSingle = (props) => () => props.urlList.length <= 1;
|
|
296
297
|
const computedIsFirst = (state) => () => state.index === 0;
|
|
297
298
|
const computedIsLast = ({ state, props }) => () => state.index === props.urlList.length - 1;
|
|
298
|
-
const computedCurrentImg = (state) => () => {
|
|
299
|
+
const computedCurrentImg = ({ state, api }) => () => {
|
|
299
300
|
if (typeof state.urlList[0] === "string") {
|
|
300
|
-
return state.urlList[state.index];
|
|
301
|
+
return api.filterImageUrl(state.urlList[state.index]);
|
|
301
302
|
} else if (typeof state.urlList[0] === "object" && state.urlList[0] !== null) {
|
|
302
|
-
return state.urlList[state.index].url;
|
|
303
|
+
return api.filterImageUrl(state.urlList[state.index].url);
|
|
303
304
|
}
|
|
304
305
|
};
|
|
305
306
|
const computedImgStyle = ({ state, constants }) => () => {
|
|
@@ -353,7 +354,7 @@ const getImageWidth = ({ state, parent, props, vm, mode }) => () => {
|
|
|
353
354
|
}
|
|
354
355
|
state.imageItemWidth = imageW;
|
|
355
356
|
state.imageAllWidth = state.urlList.length * imageW;
|
|
356
|
-
if (mode
|
|
357
|
+
if (mode === "mobile") {
|
|
357
358
|
if (props.startPosition > 0) {
|
|
358
359
|
state.index = props.startPosition;
|
|
359
360
|
state.imageTransition = 0;
|
|
@@ -412,7 +413,7 @@ const swipeRight = ({ state, emit }) => () => {
|
|
|
412
413
|
} else {
|
|
413
414
|
state.arrowStyle = null;
|
|
414
415
|
}
|
|
415
|
-
if (state.imageTransform
|
|
416
|
+
if (state.imageTransform === 0 && state.index === 0) {
|
|
416
417
|
return;
|
|
417
418
|
}
|
|
418
419
|
state.index = (state.index - 1 + len) % len;
|
|
@@ -447,9 +448,13 @@ const langClick = (state) => () => {
|
|
|
447
448
|
window.navigator.msSaveOrOpenBlob(blob, "img.png");
|
|
448
449
|
} else {
|
|
449
450
|
const a = document.createElement("a");
|
|
450
|
-
a.
|
|
451
|
+
a.style = "dispaly:none";
|
|
452
|
+
a.href = state.currentImg + "?response-content-type=application/octet-stream";
|
|
451
453
|
a.setAttribute("download", "img");
|
|
454
|
+
a.setAttribute("target", "downloadFile");
|
|
455
|
+
document.body.appendChild(a);
|
|
452
456
|
a.click();
|
|
457
|
+
document.body.removeChild(a);
|
|
453
458
|
}
|
|
454
459
|
};
|
|
455
460
|
const touchstart = ({ state, mode, api }) => (e) => {
|
|
@@ -629,6 +634,10 @@ const selectOption = ({ state, api }) => (item, index) => {
|
|
|
629
634
|
break;
|
|
630
635
|
}
|
|
631
636
|
};
|
|
637
|
+
const filterImageUrl = () => (imageUrl) => {
|
|
638
|
+
const isBase64 = /^data:image\/(png|jpg|jpeg|gif);base64,([a-zA-Z0-9+/]+={0,2})/;
|
|
639
|
+
return isBase64.test(imageUrl) ? imageUrl : xss.filterUrl(imageUrl);
|
|
640
|
+
};
|
|
632
641
|
export {
|
|
633
642
|
activeItems,
|
|
634
643
|
beforeDestroy,
|
|
@@ -640,6 +649,8 @@ export {
|
|
|
640
649
|
computedIsSingle,
|
|
641
650
|
deviceSupportInstall,
|
|
642
651
|
deviceSupportUninstall,
|
|
652
|
+
filterImageUrl,
|
|
653
|
+
getCenterPosition,
|
|
643
654
|
getDefaultPrev,
|
|
644
655
|
getImageWidth,
|
|
645
656
|
getLastPrev,
|
package/image-viewer/vue.js
CHANGED
|
@@ -34,7 +34,9 @@ import {
|
|
|
34
34
|
selectOption,
|
|
35
35
|
langClick,
|
|
36
36
|
getLastPrev,
|
|
37
|
-
getDefaultPrev
|
|
37
|
+
getDefaultPrev,
|
|
38
|
+
getCenterPosition,
|
|
39
|
+
filterImageUrl
|
|
38
40
|
} from "./index";
|
|
39
41
|
const api = [
|
|
40
42
|
"state",
|
|
@@ -72,7 +74,7 @@ const initState = ({ reactive, computed, api: api2, mode, props, constants, inje
|
|
|
72
74
|
mfPreviewVisible: inject("mfPreviewVisible", null),
|
|
73
75
|
scale: 1,
|
|
74
76
|
time: null,
|
|
75
|
-
index: mode
|
|
77
|
+
index: mode === "pc" || mode === "mobile-first" ? 0 : props.startPosition,
|
|
76
78
|
imageName: "",
|
|
77
79
|
isShow: false,
|
|
78
80
|
infinite: true,
|
|
@@ -111,7 +113,8 @@ const initState = ({ reactive, computed, api: api2, mode, props, constants, inje
|
|
|
111
113
|
fileName: "",
|
|
112
114
|
scrollTop: 0,
|
|
113
115
|
thumbnailTop: constants.THUMBNAILTOP,
|
|
114
|
-
menuTop: constants.MENUTOP
|
|
116
|
+
menuTop: constants.MENUTOP,
|
|
117
|
+
centerIndex: -1
|
|
115
118
|
});
|
|
116
119
|
return state;
|
|
117
120
|
};
|
|
@@ -135,7 +138,7 @@ const initApi = ({ api: api2, state, props, parent, nextTick, emit, t, constants
|
|
|
135
138
|
computedIsLast: computedIsLast({ state, props }),
|
|
136
139
|
watchVisible: watchVisible(state),
|
|
137
140
|
deviceSupportUninstall: deviceSupportUninstall({ state, mode }),
|
|
138
|
-
computedCurrentImg: computedCurrentImg(state),
|
|
141
|
+
computedCurrentImg: computedCurrentImg({ state, api: api2 }),
|
|
139
142
|
computedImgStyle: computedImgStyle({ state, constants }),
|
|
140
143
|
computeZIndex: computeZIndex({ constants, props }),
|
|
141
144
|
hide: hide({ props, api: api2, state }),
|
|
@@ -152,7 +155,9 @@ const initApi = ({ api: api2, state, props, parent, nextTick, emit, t, constants
|
|
|
152
155
|
selectOption: selectOption({ state, api: api2 }),
|
|
153
156
|
langClick: langClick(state),
|
|
154
157
|
getLastPrev: getLastPrev({ state, vm }),
|
|
155
|
-
getDefaultPrev: getDefaultPrev({ state, vm })
|
|
158
|
+
getDefaultPrev: getDefaultPrev({ state, vm }),
|
|
159
|
+
getCenterPosition: getCenterPosition({ state, vm }),
|
|
160
|
+
filterImageUrl: filterImageUrl()
|
|
156
161
|
});
|
|
157
162
|
};
|
|
158
163
|
const initWatch = ({ watch, state, api: api2, props, nextTick, vm }) => {
|
|
@@ -198,6 +203,13 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, vm }) => {
|
|
|
198
203
|
api2.getImageWidth();
|
|
199
204
|
})
|
|
200
205
|
);
|
|
206
|
+
watch(
|
|
207
|
+
() => props.urlList,
|
|
208
|
+
() => {
|
|
209
|
+
state.urlList = props.urlList;
|
|
210
|
+
},
|
|
211
|
+
{ deep: true }
|
|
212
|
+
);
|
|
201
213
|
};
|
|
202
214
|
const renderless = (props, { computed, onMounted, onBeforeUnmount, onUpdated, reactive, watch, inject, provide }, { t, parent, nextTick, emit, constants, vm, mode }) => {
|
|
203
215
|
const api2 = {};
|