@opentiny/vue-renderless 3.12.0 → 3.13.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 +20 -13
- package/action-sheet/vue.js +8 -7
- package/alert/index.js +50 -1
- package/alert/vue.js +36 -9
- 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 +20 -6
- package/calendar-view/index.js +10 -12
- package/calendar-view/vue.js +17 -4
- package/cascader/index.js +80 -34
- package/cascader/vue.js +49 -19
- package/cascader-menu/index.js +7 -7
- package/cascader-menu/vue.js +2 -3
- package/cascader-mobile/index.js +37 -24
- package/cascader-mobile/vue.js +7 -1
- 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/cascader-view/index.js +1 -1
- 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 +17 -0
- package/checkbox/vue.js +16 -7
- package/checkbox-group/vue.js +2 -0
- package/col/index.js +7 -2
- 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 +2 -0
- package/common/deps/dom.js +19 -4
- package/common/deps/popper.js +48 -5
- package/common/deps/touch-emulator.js +4 -1
- package/common/deps/tree-model/node.js +1 -1
- package/common/deps/tree-model/tree-store.js +2 -13
- package/common/deps/useRect.js +25 -0
- package/common/deps/vue-popper.js +22 -10
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- 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/container/index.js +17 -1
- package/container/vue.js +12 -3
- 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 +12 -5
- package/date-table/index.js +5 -0
- package/date-table/vue.js +3 -1
- package/dialog-box/index.js +17 -6
- package/dialog-select/index.js +6 -3
- package/dialog-select/vue.js +8 -4
- package/drawer/index.js +26 -5
- package/drawer/vue.js +13 -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 +21 -8
- 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 +47 -12
- package/file-upload/vue.js +38 -8
- package/filter-box/index.js +1 -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 +3 -1
- package/form-item/index.js +4 -4
- package/form-item/vue.js +3 -1
- package/fullscreen/index.js +5 -5
- package/fullscreen/vue.js +3 -3
- package/grid/utils/common.js +10 -5
- package/grid/utils/dom.js +7 -1
- package/image/index.js +6 -0
- package/image/vue.js +6 -3
- package/image-viewer/index.js +62 -51
- package/image-viewer/vue.js +17 -5
- package/input/index.js +89 -22
- package/input/vue.js +52 -21
- package/ip-address/index.js +61 -19
- package/ip-address/vue.js +22 -4
- package/label/index.js +56 -0
- package/label/vue.js +26 -0
- package/link/vue.js +3 -1
- package/loading/vue.js +8 -2
- package/logout/index.js +1 -1
- package/mask/index.js +13 -0
- package/mask/vue.js +18 -0
- package/mind-map/index.js +47 -0
- package/mind-map/vue.js +53 -0
- package/multi-select/index.js +150 -10
- package/multi-select/vue.js +46 -11
- package/multi-select-item/index.js +17 -0
- package/multi-select-item/vue.js +31 -0
- package/numeric/index.js +51 -9
- package/numeric/vue.js +44 -14
- package/option/index.js +12 -5
- package/option/vue.js +15 -7
- package/option-group/index.js +3 -3
- package/package.json +1 -1
- package/pager/index.js +372 -0
- package/pager/vue.js +125 -2
- package/picker/index.js +253 -48
- package/picker/mb.js +42 -0
- package/picker/vue.js +70 -17
- package/picker-column/index.js +1 -1
- package/pop-upload/index.js +0 -2
- package/pop-upload/vue.js +3 -4
- package/popconfirm/index.js +3 -6
- package/popconfirm/vue.js +1 -1
- package/popeditor/index.js +55 -24
- 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 +57 -65
- package/pull-refresh/vue.js +23 -7
- 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-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 +1 -1
- package/search/vue.js +3 -1
- package/select/index.js +185 -113
- package/select/vue.js +105 -20
- package/select-dropdown/index.js +62 -4
- package/select-dropdown/vue.js +85 -8
- package/select-view/index.js +3 -1
- 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 +27 -7
- package/slider/vue.js +26 -7
- package/split/index.js +1 -1
- 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 +9 -4
- package/tab-nav/vue.js +6 -2
- package/tabbar/vue.js +9 -3
- package/tabbar-item/vue.js +3 -2
- package/tabs/index.js +1 -1
- package/tabs/vue.js +1 -0
- package/tabs-mf/index.js +20 -6
- package/tabs-mf/vue-nav.js +26 -11
- package/tabs-mf/vue.js +7 -7
- package/tag/index.js +1 -1
- package/tag/vue.js +5 -1
- package/tag-group/index.js +2 -1
- package/tall-storage/index.js +4 -5
- package/time/index.js +4 -1
- package/time/vue.js +1 -1
- package/time-line/vue.js +1 -1
- package/time-picker-mobile/index.js +24 -5
- package/time-picker-mobile/vue.js +17 -7
- package/time-range/index.js +2 -0
- package/time-spinner/index.js +0 -3
- package/time-spinner/vue.js +2 -3
- package/timeline-item/vue.js +1 -1
- package/tooltip/index.js +1 -2
- package/tooltip/vue.js +3 -3
- 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 +27 -3
- package/tree-menu/vue.js +27 -14
- package/tree-node/index.js +12 -10
- package/tree-node/vue.js +6 -5
- package/types/action-menu.type.d.ts +5 -0
- package/types/action-sheet.type.d.ts +118 -1
- package/types/alert.type.d.ts +16 -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.type.d.ts +5 -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 +327 -1
- package/types/checkbox.type.d.ts +9 -0
- package/types/collapse.type.d.ts +19 -2
- package/types/date-picker.type.d.ts +33 -0
- package/types/dialog-box.type.d.ts +5 -1
- package/types/drawer.type.d.ts +132 -1
- package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8475a549.d.ts} +8 -14
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/dropdown.type.d.ts +2 -5
- package/types/fall-menu.type.d.ts +94 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-d0fd42f3.d.ts → form.type-d88482e4.d.ts} +3 -0
- package/types/form.type.d.ts +1 -1
- package/types/input.type.d.ts +23 -9
- package/types/ip-address.type.d.ts +160 -1
- package/types/label.type.d.ts +81 -0
- package/types/link.type.d.ts +6 -3
- package/types/mind-map.type.d.ts +20 -0
- package/types/modal.type.d.ts +4 -2
- package/types/numeric.type.d.ts +36 -9
- package/types/pager.type.d.ts +171 -1
- package/types/picker.type.d.ts +14 -0
- package/types/popconfirm.type.d.ts +85 -1
- package/types/popeditor.type.d.ts +4 -0
- package/types/popover.type.d.ts +3 -3
- 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 +8 -1
- package/types/steps.type.d.ts +14 -3
- package/types/tab-item.type.d.ts +0 -1
- package/types/tab-nav.type.d.ts +6 -1
- package/types/tabs.type.d.ts +5 -0
- package/types/tag-group.type.d.ts +64 -1
- package/types/tag.type.d.ts +12 -0
- package/types/tooltip.type.d.ts +1 -1
- package/types/transfer.type.d.ts +183 -1
- package/types/tree-menu.type.d.ts +210 -1
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-1078fba2.d.ts} +27 -6
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/wizard.type.d.ts +1 -0
- package/upload/index.js +59 -29
- package/upload/vue.js +6 -4
- package/upload-list/index.js +14 -14
- package/upload-list/vue.js +5 -2
- package/user/index.js +5 -4
- package/user-head/index.js +1 -1
- package/wheel/index.js +3 -0
- package/wizard/vue.js +4 -2
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 = {};
|
package/input/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { omitText } from "../common/string";
|
|
2
3
|
const HIDDEN_STYLE = `
|
|
3
4
|
height:0 !important;visibility:hidden !important;overflow:hidden !important;
|
|
4
5
|
position:absolute !important;z-index:-1000 !important;top:0 !important;right:0 !important
|
|
@@ -37,6 +38,11 @@ const showBox = (state) => () => {
|
|
|
37
38
|
}
|
|
38
39
|
state.boxVisibility = true;
|
|
39
40
|
};
|
|
41
|
+
const inputStyle = ({ props }) => () => {
|
|
42
|
+
return {
|
|
43
|
+
textAlign: props.textAlign
|
|
44
|
+
};
|
|
45
|
+
};
|
|
40
46
|
const calculateNodeStyling = () => (targetElement) => {
|
|
41
47
|
const style = window.getComputedStyle(targetElement);
|
|
42
48
|
const boxSizing = style.getPropertyValue(STYLE.BoxSizing);
|
|
@@ -51,6 +57,12 @@ const calcTextareaHeight = ({
|
|
|
51
57
|
props,
|
|
52
58
|
state
|
|
53
59
|
}) => (targetElement, minRows = 1, maxRows = null) => {
|
|
60
|
+
if (!targetElement) {
|
|
61
|
+
return {
|
|
62
|
+
minHeight: "",
|
|
63
|
+
height: ""
|
|
64
|
+
};
|
|
65
|
+
}
|
|
54
66
|
if (!hiddenTextarea) {
|
|
55
67
|
hiddenTextarea = document.createElement("textarea");
|
|
56
68
|
document.body.appendChild(hiddenTextarea);
|
|
@@ -71,7 +83,7 @@ const calcTextareaHeight = ({
|
|
|
71
83
|
minHeight = minHeight + paddingSize + borderSize;
|
|
72
84
|
}
|
|
73
85
|
if (props.size) {
|
|
74
|
-
minHeight = props.size
|
|
86
|
+
minHeight = props.size === "mini" ? minHeight * 0.67 : props.size === "small" ? minHeight : minHeight * 1.17;
|
|
75
87
|
}
|
|
76
88
|
if (props.height) {
|
|
77
89
|
minHeight = props.height;
|
|
@@ -95,7 +107,7 @@ const calcTextareaHeight = ({
|
|
|
95
107
|
hiddenTextarea = null;
|
|
96
108
|
return textareaStyle;
|
|
97
109
|
};
|
|
98
|
-
const getInput = (
|
|
110
|
+
const getInput = (vm) => () => vm.$refs.input || vm.$refs.textarea;
|
|
99
111
|
const blur = (api) => () => api.getInput().blur();
|
|
100
112
|
const focus = (api) => () => api.getInput().focus();
|
|
101
113
|
const select = (api) => () => api.getInput().select();
|
|
@@ -105,7 +117,8 @@ const handleBlur = ({
|
|
|
105
117
|
eventName,
|
|
106
118
|
emit,
|
|
107
119
|
props,
|
|
108
|
-
state
|
|
120
|
+
state,
|
|
121
|
+
vm
|
|
109
122
|
}) => (event) => {
|
|
110
123
|
state.focused = false;
|
|
111
124
|
emit("blur", event);
|
|
@@ -113,6 +126,9 @@ const handleBlur = ({
|
|
|
113
126
|
if (props.validateEvent) {
|
|
114
127
|
api.dispatch(componentName, eventName, [props.modelValue]);
|
|
115
128
|
}
|
|
129
|
+
if (props.hoverExpand) {
|
|
130
|
+
vm.$refs.textarea.scrollTop = 0;
|
|
131
|
+
}
|
|
116
132
|
};
|
|
117
133
|
const handleFocus = ({ api, emit, state }) => (event) => {
|
|
118
134
|
state.focused = true;
|
|
@@ -132,7 +148,7 @@ const handleInput = ({ api, emit, nextTick, state }) => (event) => {
|
|
|
132
148
|
nextTick(api.setNativeInputValue);
|
|
133
149
|
};
|
|
134
150
|
const handleChange = (emit) => (event) => emit("change", event.target.value);
|
|
135
|
-
const resizeTextarea = ({ api, parent,
|
|
151
|
+
const resizeTextarea = ({ api, parent, vm, state, props }) => () => {
|
|
136
152
|
if (isServer) {
|
|
137
153
|
return;
|
|
138
154
|
}
|
|
@@ -140,15 +156,22 @@ const resizeTextarea = ({ api, parent, refs, state }) => () => {
|
|
|
140
156
|
if (type !== "textarea") {
|
|
141
157
|
return;
|
|
142
158
|
}
|
|
159
|
+
if (props.hoverExpand && !state.enteredTextarea) {
|
|
160
|
+
state.textareaCalcStyle = {
|
|
161
|
+
minHeight: state.textareaHeight,
|
|
162
|
+
height: state.textareaHeight
|
|
163
|
+
};
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
143
166
|
if (!autosize) {
|
|
144
167
|
state.textareaCalcStyle = {
|
|
145
|
-
minHeight: api.calcTextareaHeight(refs.textarea).minHeight
|
|
168
|
+
minHeight: api.calcTextareaHeight(vm.$refs.textarea).minHeight
|
|
146
169
|
};
|
|
147
170
|
return;
|
|
148
171
|
}
|
|
149
172
|
const minRows = autosize.minRows;
|
|
150
173
|
const maxRows = autosize.maxRows;
|
|
151
|
-
state.textareaCalcStyle = api.calcTextareaHeight(refs.textarea, minRows, maxRows);
|
|
174
|
+
state.textareaCalcStyle = api.calcTextareaHeight(vm.$refs.textarea, minRows, maxRows);
|
|
152
175
|
};
|
|
153
176
|
const setNativeInputValue = ({ api, state }) => () => {
|
|
154
177
|
const input = api.getInput();
|
|
@@ -217,7 +240,7 @@ const handlePasswordVisible = ({ api, nextTick, state }) => () => {
|
|
|
217
240
|
state.passwordVisible = !state.passwordVisible;
|
|
218
241
|
nextTick(api.focus);
|
|
219
242
|
};
|
|
220
|
-
const getSuffixVisible = ({ parent, props, state }) => () => parent.$slots.suffix || props.suffixIcon || state.showClear || props.showPassword || state.isWordLimitVisible || state.validateState && state.needStatusIcon;
|
|
243
|
+
const getSuffixVisible = ({ parent, props, state }) => () => parent.$slots.suffix || props.suffixIcon || state.showClear || props.showPassword || state.isWordLimitVisible || state.validateState && state.needStatusIcon || props.mask && state.inputDisabled;
|
|
221
244
|
const textLength = (value) => {
|
|
222
245
|
if (typeof value === "number") {
|
|
223
246
|
return String(value).length;
|
|
@@ -229,7 +252,7 @@ const watchFormSelect = ({ emit, props, state }) => (value) => {
|
|
|
229
252
|
emit("update:modelValue", value);
|
|
230
253
|
emit("change", value);
|
|
231
254
|
const filterData = props.selectMenu.length && props.selectMenu.filter((item) => item.id === value).shift();
|
|
232
|
-
state.
|
|
255
|
+
state.checkedLabel = filterData ? filterData.label : "";
|
|
233
256
|
}
|
|
234
257
|
};
|
|
235
258
|
const hasSelection = (api) => () => {
|
|
@@ -238,8 +261,25 @@ const hasSelection = (api) => () => {
|
|
|
238
261
|
};
|
|
239
262
|
const handleEnterDisplayOnlyContent = ({ state, props }) => ($event, type) => {
|
|
240
263
|
const target = $event.target;
|
|
241
|
-
|
|
264
|
+
state.displayOnlyTooltip = "";
|
|
265
|
+
if (!target) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const isOverText = target.scrollWidth > target.offsetWidth || type === "textarea" && target.scrollHeight > target.offsetHeight;
|
|
269
|
+
if (isOverText) {
|
|
242
270
|
state.displayOnlyTooltip = props.displayOnlyContent || state.nativeInputValue;
|
|
271
|
+
} else {
|
|
272
|
+
let isOverTextWhenMask = false;
|
|
273
|
+
if (props.mask && state.maskValueVisible) {
|
|
274
|
+
const text = target.textContent;
|
|
275
|
+
const font = window.getComputedStyle(target).font;
|
|
276
|
+
const rect = target.getBoundingClientRect();
|
|
277
|
+
const iconWidth = 16 + 15;
|
|
278
|
+
isOverTextWhenMask = omitText(text, font, rect.width - iconWidth).o;
|
|
279
|
+
}
|
|
280
|
+
if (isOverTextWhenMask) {
|
|
281
|
+
state.displayOnlyTooltip = props.displayOnlyContent || state.nativeInputValue;
|
|
282
|
+
}
|
|
243
283
|
}
|
|
244
284
|
};
|
|
245
285
|
const hiddenPassword = ({ state, props }) => () => {
|
|
@@ -250,30 +290,53 @@ const hiddenPassword = ({ state, props }) => () => {
|
|
|
250
290
|
}
|
|
251
291
|
return str;
|
|
252
292
|
};
|
|
253
|
-
const
|
|
254
|
-
if (state.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
});
|
|
293
|
+
const getDisplayedMaskValue = ({ state }) => () => {
|
|
294
|
+
if (state.maskValueVisible) {
|
|
295
|
+
return state.nativeInputValue;
|
|
296
|
+
} else {
|
|
297
|
+
return state.nativeInputValue && state.maskSymbol;
|
|
259
298
|
}
|
|
260
299
|
};
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
300
|
+
const setInputDomValue = ({ state, props, nextTick, vm }) => (type) => {
|
|
301
|
+
nextTick(() => {
|
|
302
|
+
const input = vm.$refs.input;
|
|
303
|
+
if (props.mask && state.nativeInputValue && input) {
|
|
304
|
+
input.value = state.maskValueVisible || !state.inputDisabled ? state.nativeInputValue : state.maskSymbol;
|
|
305
|
+
}
|
|
306
|
+
if (type === "mask" && !props.mask && input) {
|
|
307
|
+
input.value = state.nativeInputValue;
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
const handleEnterTextarea = ({ api, state, props, nextTick }) => () => {
|
|
312
|
+
if (props.hoverExpand && !state.isDisplayOnly) {
|
|
313
|
+
state.enteredTextarea = true;
|
|
314
|
+
nextTick(api.resizeTextarea);
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const handleLeaveTextarea = ({ api, state, props, nextTick, vm }) => () => {
|
|
318
|
+
if (props.hoverExpand && !state.isDisplayOnly) {
|
|
319
|
+
state.enteredTextarea = false;
|
|
320
|
+
nextTick(() => {
|
|
321
|
+
api.resizeTextarea();
|
|
322
|
+
vm.$refs.textarea.scrollTop = 0;
|
|
323
|
+
});
|
|
266
324
|
}
|
|
267
325
|
};
|
|
326
|
+
const getDisplayOnlyText = ({ parent, state, props }) => () => {
|
|
327
|
+
const text = props.displayOnlyContent || state.nativeInputValue;
|
|
328
|
+
const showEmptyValue = typeof props.showEmptyValue === "boolean" ? props.showEmptyValue : (parent.tinyForm || {}).showEmptyValue;
|
|
329
|
+
return showEmptyValue ? text : text || "-";
|
|
330
|
+
};
|
|
268
331
|
export {
|
|
269
332
|
blur,
|
|
270
333
|
calcIconOffset,
|
|
271
334
|
calcTextareaHeight,
|
|
272
335
|
calculateNodeStyling,
|
|
273
336
|
clear,
|
|
274
|
-
dispatchDisplayedValue,
|
|
275
337
|
focus,
|
|
276
|
-
|
|
338
|
+
getDisplayOnlyText,
|
|
339
|
+
getDisplayedMaskValue,
|
|
277
340
|
getInput,
|
|
278
341
|
getSuffixVisible,
|
|
279
342
|
handleBlur,
|
|
@@ -282,13 +345,17 @@ export {
|
|
|
282
345
|
handleCompositionStart,
|
|
283
346
|
handleCompositionUpdate,
|
|
284
347
|
handleEnterDisplayOnlyContent,
|
|
348
|
+
handleEnterTextarea,
|
|
285
349
|
handleFocus,
|
|
286
350
|
handleInput,
|
|
351
|
+
handleLeaveTextarea,
|
|
287
352
|
handlePasswordVisible,
|
|
288
353
|
hasSelection,
|
|
289
354
|
hiddenPassword,
|
|
355
|
+
inputStyle,
|
|
290
356
|
resizeTextarea,
|
|
291
357
|
select,
|
|
358
|
+
setInputDomValue,
|
|
292
359
|
setNativeInputValue,
|
|
293
360
|
showBox,
|
|
294
361
|
textLength,
|