@opentiny/vue-renderless 3.17.6 → 3.18.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/README.md +12 -3
- package/anchor/index.js +6 -2
- package/autocomplete/index.js +12 -11
- package/autocomplete/vue.js +35 -7
- package/collapse-item/index.js +7 -1
- package/collapse-item/vue.js +12 -2
- package/color-picker/index.js +20 -32
- package/color-picker/vue.js +31 -54
- package/color-select-panel/index.js +8 -5
- package/color-select-panel/vue.js +1 -2
- package/common/deps/clickoutside.js +10 -3
- package/common/deps/tree-model/tree-store.js +13 -2
- package/common/deps/useRelation.js +24 -7
- package/common/form/const.js +10 -0
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/dialog-box/index.js +1 -1
- package/dialog-select/index.js +40 -13
- package/dialog-select/vue.js +3 -3
- package/dropdown-item/mf.js +1 -1
- package/dropdown-menu/index.js +3 -0
- package/dropdown-menu/vue.js +5 -3
- package/file-upload/index.js +4 -4
- package/fluent-editor/index.js +10 -3
- package/fluent-editor/options.js +32 -2
- package/fluent-editor/vue.js +8 -8
- package/form-item/index.js +6 -1
- package/form-item/vue.js +3 -1
- package/guide/index.js +4 -4
- package/input/index.js +15 -0
- package/input/vue.js +11 -4
- package/option/index.js +0 -15
- package/option/vue.js +2 -13
- package/package.json +1 -1
- package/pager-item/index.js +4 -7
- package/picker/index.js +27 -7
- package/picker/vue.js +2 -1
- package/pop-upload/index.js +13 -4
- package/pop-upload/vue.js +4 -0
- package/popeditor/index.js +2 -1
- package/rich-text-editor/vue.js +9 -3
- package/select/index.js +5 -4
- package/select/vue.js +12 -4
- package/slider-button/index.js +8 -3
- package/slider-button/vue.js +6 -2
- package/slider-button-group/index.js +46 -9
- package/slider-button-group/vue.js +39 -18
- package/tab-item-mf/vue.js +6 -1
- package/tabs-mf/index.js +58 -3
- package/tabs-mf/vue-bar.js +0 -6
- package/tabs-mf/vue-swipe.js +20 -0
- package/tabs-mf/vue.js +22 -4
- package/time/index.js +6 -1
- package/time/vue.js +7 -2
- package/time-line/index.js +1 -1
- package/time-line-new/index.js +53 -0
- package/time-line-new/vue.js +41 -0
- package/time-spinner/index.js +1 -1
- package/time-spinner/vue.js +2 -2
- package/tooltip/vue.js +16 -3
- package/tree/index.js +1 -0
- package/tree/vue.js +4 -1
- package/tree-select/index.js +6 -6
- package/tree-select/vue.js +1 -1
- package/types/autocomplete.type.d.ts +16 -12
- package/types/button.type.d.ts +22 -1
- package/types/checkbox.type.d.ts +1 -0
- package/types/dropdown.type.d.ts +4 -0
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-33aa784a.d.ts → form.type-f6fb4c38.d.ts} +5 -0
- package/types/form.type.d.ts +1 -1
- package/types/input.type.d.ts +5 -1
- package/types/link.type.d.ts +6 -1
- package/types/search.type.d.ts +7 -0
- package/types/tree-menu.type.d.ts +0 -1
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-02a1effb.d.ts → upload-list.type-4194f534.d.ts} +6 -0
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-head.type.d.ts +4 -1
package/picker/index.js
CHANGED
|
@@ -47,7 +47,7 @@ const watchMobileVisible = ({ api, props, state, nextTick }) => ([dateMobileVisi
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
const watchPickerVisible = ({ api, vm, dispatch, emit, props, state, nextTick }) => (value) => {
|
|
50
|
-
if (props.readonly || state.pickerDisabled || state.
|
|
50
|
+
if (props.readonly || state.pickerDisabled || state.isMobileMode)
|
|
51
51
|
return;
|
|
52
52
|
if (value) {
|
|
53
53
|
api.showPicker();
|
|
@@ -167,7 +167,7 @@ const getTimezone = ({ props, utils }) => () => {
|
|
|
167
167
|
const setting = utils.getDateFormat && utils.getDateFormat();
|
|
168
168
|
const { DbTimezone, Timezone, TimezoneOffset } = setting || {};
|
|
169
169
|
const cur = getLocalTimezone();
|
|
170
|
-
const isTzNumber = (z) => typeof z === "number" && z >= -12 && z <=
|
|
170
|
+
const isTzNumber = (z) => typeof z === "number" && z >= -12 && z <= 14;
|
|
171
171
|
if (!~type.indexOf("datetime")) {
|
|
172
172
|
return { from: cur, to: cur };
|
|
173
173
|
}
|
|
@@ -429,15 +429,35 @@ const getSelectionStart = ({ value, format, regx, event }) => {
|
|
|
429
429
|
}
|
|
430
430
|
return { selectionStart, I };
|
|
431
431
|
};
|
|
432
|
+
const getEffectiveDateString = (formatStr) => {
|
|
433
|
+
const serializationList = [{ "MM": "01" }, { "M": "1" }, { "dd": "01" }, { "d": "1" }];
|
|
434
|
+
let result = formatStr;
|
|
435
|
+
serializationList.forEach((item) => {
|
|
436
|
+
const itemKey = Object.keys(item)[0];
|
|
437
|
+
if (result.includes(itemKey)) {
|
|
438
|
+
result = result.replace(itemKey, item[itemKey]);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
return result;
|
|
442
|
+
};
|
|
432
443
|
const getNum = (value, format, regx) => {
|
|
433
444
|
let len = value.length;
|
|
445
|
+
let formatStr = "";
|
|
434
446
|
if (format && regx) {
|
|
435
447
|
const formatMatchArr = format.match(regx);
|
|
436
|
-
|
|
448
|
+
formatStr = formatMatchArr.join("");
|
|
449
|
+
len = Math.max(len, formatStr.length);
|
|
437
450
|
}
|
|
438
|
-
|
|
451
|
+
const num = { str: "", arr: [] };
|
|
439
452
|
for (let i = 0; i < len; i++) {
|
|
440
|
-
let
|
|
453
|
+
let fillStr = "0";
|
|
454
|
+
if (formatStr && len > value.length) {
|
|
455
|
+
const validStr = getEffectiveDateString(formatStr);
|
|
456
|
+
if (/[0-9]/.test(validStr[i])) {
|
|
457
|
+
fillStr = validStr[i];
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
const char = value.charAt(i) ? value.charAt(i) : fillStr;
|
|
441
461
|
if (/[0-9]/.test(char)) {
|
|
442
462
|
num.str += char;
|
|
443
463
|
} else {
|
|
@@ -683,9 +703,9 @@ const handleClose = ({ api, props, state }) => () => {
|
|
|
683
703
|
const handleFocus = ({ emit, vm, state, api }) => () => {
|
|
684
704
|
const type = state.type;
|
|
685
705
|
if (DATEPICKER.TriggerTypes.includes(type)) {
|
|
686
|
-
if (state.
|
|
706
|
+
if (state.isMobileMode && state.isDateMobileComponent) {
|
|
687
707
|
api.dateMobileToggle(true);
|
|
688
|
-
} else if (state.
|
|
708
|
+
} else if (state.isMobileMode && state.isTimeMobileComponent) {
|
|
689
709
|
api.timeMobileToggle(true);
|
|
690
710
|
} else {
|
|
691
711
|
state.pickerVisible = true;
|
package/picker/vue.js
CHANGED
|
@@ -123,7 +123,7 @@ const initState = ({ api: api2, reactive, vm, computed, props, utils, parent, br
|
|
|
123
123
|
labelTooltip: "",
|
|
124
124
|
displayOnlyTooltip: "",
|
|
125
125
|
isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly),
|
|
126
|
-
|
|
126
|
+
isMobileMode: computed(() => vm.$mode.includes("mobile")),
|
|
127
127
|
dateMobileOption: {
|
|
128
128
|
visible: false,
|
|
129
129
|
type: props.type,
|
|
@@ -254,6 +254,7 @@ const initWatch = ({ api: api2, state, props, watch, markRaw }) => {
|
|
|
254
254
|
(value) => state.picker && (state.picker.state.value = value),
|
|
255
255
|
{ immediate: true }
|
|
256
256
|
);
|
|
257
|
+
watch(() => props.type, api2.mountPicker);
|
|
257
258
|
watch(() => props.isRange, api2.watchIsRange);
|
|
258
259
|
watch(() => props.modelValue, api2.watchModelValue);
|
|
259
260
|
watch(() => props.pickerOptions, api2.updateOptions, { deep: true });
|
package/pop-upload/index.js
CHANGED
|
@@ -6,6 +6,14 @@ const computedconfirm = ({ constants, props, t }) => () => props.submitButtonTex
|
|
|
6
6
|
const computedFileName = ({ constants, t }) => () => t(constants.FILE_NAME);
|
|
7
7
|
const computedUploadError = ({ constants, t }) => () => t(constants.UPLOAD_ERROR);
|
|
8
8
|
const computedFileStatus = ({ constants, t }) => () => t(constants.FILE_STATUS);
|
|
9
|
+
const computedFileWords = ({ t }) => () => ({
|
|
10
|
+
operation: t("ui.popupload.operation"),
|
|
11
|
+
waitUpload: t("ui.popupload.waitUpload"),
|
|
12
|
+
success: t("ui.popupload.success"),
|
|
13
|
+
uploadError: t("ui.popupload.uploadError"),
|
|
14
|
+
confirmDeleteTips: t("ui.popupload.confirmDeleteTips"),
|
|
15
|
+
delete: t("ui.popupload.delete")
|
|
16
|
+
});
|
|
9
17
|
const computedFileSize = ({ constants, t }) => () => t(constants.FILE_SIZE);
|
|
10
18
|
const computedErrorSizeTips = ({ constants, t }) => () => t(constants.ERROR_SIZE_TIPS);
|
|
11
19
|
const computedErrorNumTips = ({ constants, t }) => () => t(constants.ERROR_NUM_TIPS);
|
|
@@ -45,7 +53,7 @@ const closeErrorTips = (state) => () => state.errorTips = [];
|
|
|
45
53
|
const closeSuccessTips = (state) => () => state.successTips = [];
|
|
46
54
|
const watchLimit = (state) => (value) => {
|
|
47
55
|
state.limit = value;
|
|
48
|
-
if (value
|
|
56
|
+
if (value !== void 0 && value > 0) {
|
|
49
57
|
state.tipsTitle[0] = {
|
|
50
58
|
count: value
|
|
51
59
|
};
|
|
@@ -65,7 +73,7 @@ const watchUploaFileType = (state) => (value) => {
|
|
|
65
73
|
};
|
|
66
74
|
const watchMaxUploadFileSize = ({ constants, state }) => (value) => {
|
|
67
75
|
state.maxUploadFileSize = value;
|
|
68
|
-
if (value
|
|
76
|
+
if (value !== void 0 && value !== 0) {
|
|
69
77
|
state.tipsTitle[2] = {
|
|
70
78
|
size: Math.floor(value / 1024) + constants.KB
|
|
71
79
|
};
|
|
@@ -106,7 +114,7 @@ const beforeAvatarUpload = ({ props, state }) => (file) => {
|
|
|
106
114
|
let filepath = file.name;
|
|
107
115
|
let isnext = false;
|
|
108
116
|
let isSize = false;
|
|
109
|
-
if (state.uploadFileType && state.uploadFileType.length
|
|
117
|
+
if (state.uploadFileType && state.uploadFileType.length !== 0) {
|
|
110
118
|
let arr = filepath.split(".");
|
|
111
119
|
let fileend = "." + arr[arr.length - 1];
|
|
112
120
|
isnext = !~state.uploadFileType.indexOf(fileend);
|
|
@@ -114,7 +122,7 @@ const beforeAvatarUpload = ({ props, state }) => (file) => {
|
|
|
114
122
|
state.errorTips.push({ type: file.name });
|
|
115
123
|
}
|
|
116
124
|
}
|
|
117
|
-
if (state.maxUploadFileSize && state.maxUploadFileSize
|
|
125
|
+
if (state.maxUploadFileSize && state.maxUploadFileSize !== 0) {
|
|
118
126
|
if (file.size > state.maxUploadFileSize) {
|
|
119
127
|
state.errorTips.push({ size: file.name });
|
|
120
128
|
isSize = true;
|
|
@@ -135,6 +143,7 @@ export {
|
|
|
135
143
|
computedFileName,
|
|
136
144
|
computedFileSize,
|
|
137
145
|
computedFileStatus,
|
|
146
|
+
computedFileWords,
|
|
138
147
|
computedLimitCountTips,
|
|
139
148
|
computedLimitSizeTips,
|
|
140
149
|
computedLimitTypeTips,
|
package/pop-upload/vue.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
computedErrorTypeTips,
|
|
17
17
|
computedFileName,
|
|
18
18
|
computedFileStatus,
|
|
19
|
+
computedFileWords,
|
|
19
20
|
computedFileSize,
|
|
20
21
|
computedLimitSizeTips,
|
|
21
22
|
computedLimitTypeTips,
|
|
@@ -77,6 +78,8 @@ const initState = ({ reactive, props, computed, api: api2 }) => reactive({
|
|
|
77
78
|
fileSize: computed(() => api2.computedFileSize()),
|
|
78
79
|
fileName: computed(() => api2.computedFileName()),
|
|
79
80
|
fileStatus: computed(() => api2.computedFileStatus()),
|
|
81
|
+
// tiny新增
|
|
82
|
+
fileWords: computed(() => api2.computedFileWords()),
|
|
80
83
|
cancelButtonText: computed(() => api2.computedCancel()),
|
|
81
84
|
submitButtonText: computed(() => api2.computedconfirm()),
|
|
82
85
|
errorNumTips: computed(() => api2.computedErrorNumTips()),
|
|
@@ -120,6 +123,7 @@ const initApi = ({ api: api2, state, refs, emit, props, constants, t }) => {
|
|
|
120
123
|
computedFileSize: computedFileSize({ constants, t }),
|
|
121
124
|
computedCancel: computedCancel({ constants, props, t }),
|
|
122
125
|
computedFileStatus: computedFileStatus({ constants, t }),
|
|
126
|
+
computedFileWords: computedFileWords({ t }),
|
|
123
127
|
computedconfirm: computedconfirm({ constants, props, t }),
|
|
124
128
|
computedUploadError: computedUploadError({ constants, t }),
|
|
125
129
|
computedErrorNumTips: computedErrorNumTips({ constants, t }),
|
package/popeditor/index.js
CHANGED
|
@@ -27,7 +27,8 @@ const createSearchForm = (props) => (isRest) => props.conditions.reduce((acc, it
|
|
|
27
27
|
return acc;
|
|
28
28
|
}, {});
|
|
29
29
|
const getColumns = ({ constants, props }) => {
|
|
30
|
-
const { columns } = props.gridOp;
|
|
30
|
+
const { columns: preColumns } = props.gridOp;
|
|
31
|
+
const columns = preColumns.slice(0);
|
|
31
32
|
const selectionCol = find(
|
|
32
33
|
columns,
|
|
33
34
|
(col) => col.type === constants.COLUMNS_TYPE.selection || col.type === constants.COLUMNS_TYPE.radio
|
package/rich-text-editor/vue.js
CHANGED
|
@@ -27,7 +27,7 @@ const api = [
|
|
|
27
27
|
"eventClick",
|
|
28
28
|
"Active"
|
|
29
29
|
];
|
|
30
|
-
const renderless = (props, { computed, onBeforeUnmount, reactive }, { vm, emit }, {
|
|
30
|
+
const renderless = (props, { computed, onBeforeUnmount, reactive, watch }, { vm, emit }, {
|
|
31
31
|
Editor,
|
|
32
32
|
StarterKit,
|
|
33
33
|
Table,
|
|
@@ -117,7 +117,7 @@ const renderless = (props, { computed, onBeforeUnmount, reactive }, { vm, emit }
|
|
|
117
117
|
addAttributes() {
|
|
118
118
|
return {
|
|
119
119
|
level: {
|
|
120
|
-
default: 1
|
|
120
|
+
default: 1.5
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
},
|
|
@@ -143,7 +143,7 @@ const renderless = (props, { computed, onBeforeUnmount, reactive }, { vm, emit }
|
|
|
143
143
|
addAttributes() {
|
|
144
144
|
return {
|
|
145
145
|
size: {
|
|
146
|
-
default:
|
|
146
|
+
default: 14
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
},
|
|
@@ -282,6 +282,12 @@ const renderless = (props, { computed, onBeforeUnmount, reactive }, { vm, emit }
|
|
|
282
282
|
onBeforeUnmount(() => {
|
|
283
283
|
state.editor.destroy();
|
|
284
284
|
});
|
|
285
|
+
watch(
|
|
286
|
+
() => props.modelValue,
|
|
287
|
+
(value) => {
|
|
288
|
+
state.editor.commands.setContent(value);
|
|
289
|
+
}
|
|
290
|
+
);
|
|
285
291
|
return api2;
|
|
286
292
|
};
|
|
287
293
|
export {
|
package/select/index.js
CHANGED
|
@@ -640,9 +640,6 @@ const toggleMenu = ({ vm, state, props, api }) => (e) => {
|
|
|
640
640
|
const enterCode = 13;
|
|
641
641
|
const nodeName = event.target && event.target.nodeName;
|
|
642
642
|
const toggleVisible = props.ignoreEnter ? event.keyCode !== enterCode && nodeName === "INPUT" : true;
|
|
643
|
-
if (!props.displayOnly) {
|
|
644
|
-
event.stopPropagation();
|
|
645
|
-
}
|
|
646
643
|
if (!state.selectDisabled) {
|
|
647
644
|
toggleVisible && !state.softFocus && (state.visible = !state.visible);
|
|
648
645
|
state.softFocus = false;
|
|
@@ -1588,7 +1585,7 @@ const computedDisabledTooltipContent = ({ props, state }) => () => {
|
|
|
1588
1585
|
return state.selected.state ? state.selected.state.currentLabel : state.selected.currentLabel;
|
|
1589
1586
|
}
|
|
1590
1587
|
};
|
|
1591
|
-
const computedSelectDisabled = ({
|
|
1588
|
+
const computedSelectDisabled = ({ state }) => () => state.isDisabled || state.isDisplayOnly;
|
|
1592
1589
|
const computedIsExpand = ({ props, state }) => () => {
|
|
1593
1590
|
const hoverExpanded = (state.selectHover || state.visible) && props.hoverExpand && !props.disabled;
|
|
1594
1591
|
const clickExpanded = props.clickExpand && state.exceedMaxVisibleRow && state.showCollapseTag;
|
|
@@ -1641,6 +1638,8 @@ const watchShowClose = ({ nextTick, state, parent }) => () => {
|
|
|
1641
1638
|
}
|
|
1642
1639
|
});
|
|
1643
1640
|
};
|
|
1641
|
+
const computedShowTagText = ({ state }) => () => state.isDisplayOnly;
|
|
1642
|
+
const isTagClosable = () => (item) => !item.required;
|
|
1644
1643
|
const computedGetIcon = ({ designConfig, props }) => () => {
|
|
1645
1644
|
return props.dropdownIcon ? { icon: props.dropdownIcon } : {
|
|
1646
1645
|
icon: (designConfig == null ? void 0 : designConfig.icons.dropdownIcon) || "icon-delta-down",
|
|
@@ -1701,6 +1700,7 @@ export {
|
|
|
1701
1700
|
computedShowClose,
|
|
1702
1701
|
computedShowCopy,
|
|
1703
1702
|
computedShowNewOption,
|
|
1703
|
+
computedShowTagText,
|
|
1704
1704
|
computedTagsStyle,
|
|
1705
1705
|
debouncRquest,
|
|
1706
1706
|
defaultOnQueryChange,
|
|
@@ -1739,6 +1739,7 @@ export {
|
|
|
1739
1739
|
handleResize,
|
|
1740
1740
|
initQuery,
|
|
1741
1741
|
initValue,
|
|
1742
|
+
isTagClosable,
|
|
1742
1743
|
loadTreeData,
|
|
1743
1744
|
managePlaceholder,
|
|
1744
1745
|
mounted,
|
package/select/vue.js
CHANGED
|
@@ -109,7 +109,9 @@ import {
|
|
|
109
109
|
clearNoMatchValue,
|
|
110
110
|
handleDebouncedQueryChange,
|
|
111
111
|
onClickCollapseTag,
|
|
112
|
-
computedIsExpand
|
|
112
|
+
computedIsExpand,
|
|
113
|
+
computedShowTagText,
|
|
114
|
+
isTagClosable
|
|
113
115
|
} from "./index";
|
|
114
116
|
import debounce from "../common/deps/debounce";
|
|
115
117
|
import { isNumber } from "../common/type";
|
|
@@ -172,7 +174,9 @@ const api = [
|
|
|
172
174
|
"loadTreeData",
|
|
173
175
|
"updateModelValue",
|
|
174
176
|
"clearSearchText",
|
|
175
|
-
"onClickCollapseTag"
|
|
177
|
+
"onClickCollapseTag",
|
|
178
|
+
"computedShowTagText",
|
|
179
|
+
"isTagClosable"
|
|
176
180
|
];
|
|
177
181
|
const initState = ({ reactive, computed, props, api: api2, emitter, parent, constants, useBreakpoint, vm, designConfig }) => {
|
|
178
182
|
const stateAdd = initStateAdd({ computed, props, api: api2, parent });
|
|
@@ -283,6 +287,8 @@ const initStateAdd = ({ computed, props, api: api2, parent }) => {
|
|
|
283
287
|
formItemSize: computed(() => (parent.formItem || { state: {} }).state.formItemSize),
|
|
284
288
|
selectDisabled: computed(() => api2.computedSelectDisabled()),
|
|
285
289
|
isDisplayOnly: computed(() => props.displayOnly || (parent.form || {}).displayOnly),
|
|
290
|
+
isDisabled: computed(() => props.disabled || (parent.form || {}).disabled),
|
|
291
|
+
isShowTagText: computed(() => api2.computedShowTagText()),
|
|
286
292
|
gridCheckedData: computed(() => api2.getcheckedData()),
|
|
287
293
|
isExpandAll: computed(() => api2.computedIsExpandAll()),
|
|
288
294
|
searchSingleCopy: computed(() => props.allowCopy && !props.multiple && (props.filterable || props.searchable)),
|
|
@@ -376,7 +382,7 @@ const initApi = ({
|
|
|
376
382
|
computedShowCopy: computedShowCopy({ props, state }),
|
|
377
383
|
computedOptionsAllDisabled: computedOptionsAllDisabled(state),
|
|
378
384
|
computedDisabledTooltipContent: computedDisabledTooltipContent({ props, state }),
|
|
379
|
-
computedSelectDisabled: computedSelectDisabled({
|
|
385
|
+
computedSelectDisabled: computedSelectDisabled({ state }),
|
|
380
386
|
computedIsExpand: computedIsExpand({ props, state }),
|
|
381
387
|
computedIsExpandAll: computedIsExpandAll(props),
|
|
382
388
|
watchInitValue: watchInitValue({ props, emit }),
|
|
@@ -385,7 +391,9 @@ const initApi = ({
|
|
|
385
391
|
computedGetIcon: computedGetIcon({ designConfig, props }),
|
|
386
392
|
computedGetTagType: computedGetTagType({ designConfig, props }),
|
|
387
393
|
clearSearchText: clearSearchText({ state, api: api2 }),
|
|
388
|
-
clearNoMatchValue: clearNoMatchValue({ props, emit })
|
|
394
|
+
clearNoMatchValue: clearNoMatchValue({ props, emit }),
|
|
395
|
+
computedShowTagText: computedShowTagText({ state }),
|
|
396
|
+
isTagClosable: isTagClosable()
|
|
389
397
|
});
|
|
390
398
|
addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, isMobileFirstMode, designConfig });
|
|
391
399
|
};
|
package/slider-button/index.js
CHANGED
|
@@ -22,13 +22,17 @@ const getGroup = ({ constants, parent: $parent }) => () => {
|
|
|
22
22
|
return parent;
|
|
23
23
|
};
|
|
24
24
|
const mounted = ({ vm, props, dispatch, constants }) => () => {
|
|
25
|
-
dispatch(constants.SLIDER_BUTTON_GROUP, "labelValue", [props.label || props.text]);
|
|
26
25
|
dispatch(constants.SLIDER_BUTTON_GROUP, "eachBlock", [
|
|
27
26
|
vm.$refs.sliderButton.offsetLeft,
|
|
28
27
|
vm.$refs.sliderButton.offsetWidth,
|
|
29
|
-
vm.$refs.sliderButton.offsetHeight
|
|
28
|
+
vm.$refs.sliderButton.offsetHeight,
|
|
29
|
+
props.label || props.text,
|
|
30
|
+
vm.$refs.sliderButton
|
|
30
31
|
]);
|
|
31
32
|
};
|
|
33
|
+
const unMounted = ({ props, dispatch, constants }) => () => {
|
|
34
|
+
dispatch(constants.SLIDER_BUTTON_GROUP, "delBlock", [props.label || props.text]);
|
|
35
|
+
};
|
|
32
36
|
const customEvents = ({ props, vm, type }) => {
|
|
33
37
|
const sliderInput = vm.$refs.sliderInput;
|
|
34
38
|
for (let ev in props.events) {
|
|
@@ -41,5 +45,6 @@ export {
|
|
|
41
45
|
getValue,
|
|
42
46
|
handleChange,
|
|
43
47
|
mounted,
|
|
44
|
-
setValue
|
|
48
|
+
setValue,
|
|
49
|
+
unMounted
|
|
45
50
|
};
|
package/slider-button/vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { handleChange, getValue, setValue, getGroup, mounted, customEvents } from "./index";
|
|
2
|
+
import { handleChange, getValue, setValue, getGroup, mounted, unMounted, customEvents } from "./index";
|
|
3
3
|
const api = ["state", "handleChange"];
|
|
4
|
-
const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmount }, { emit, parent, dispatch, constants, nextTick, vm }) => {
|
|
4
|
+
const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmount, watch }, { emit, parent, dispatch, constants, nextTick, vm }) => {
|
|
5
5
|
const state = reactive({
|
|
6
6
|
disabled: inject("disabled", null) || props.disabled,
|
|
7
7
|
type: inject("sliderType", null),
|
|
@@ -9,6 +9,7 @@ const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmo
|
|
|
9
9
|
get: () => api2.getValue(),
|
|
10
10
|
set: (val) => api2.setValue(val)
|
|
11
11
|
}),
|
|
12
|
+
label: computed(() => props.label || props.text),
|
|
12
13
|
sliderButtonGroup: computed(() => api2.getGroup()),
|
|
13
14
|
size: inject("sliderSize", null),
|
|
14
15
|
tabIndex: computed(() => state.sliderButtonGroup && state.value !== (props.label || props.text) ? -1 : 0)
|
|
@@ -17,6 +18,7 @@ const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmo
|
|
|
17
18
|
Object.assign(api2, {
|
|
18
19
|
state,
|
|
19
20
|
mounted: mounted({ vm, props, dispatch, constants, state, nextTick }),
|
|
21
|
+
unMounted: unMounted({ props, dispatch, constants }),
|
|
20
22
|
getValue: getValue(state),
|
|
21
23
|
setValue: setValue({ emit, state }),
|
|
22
24
|
getGroup: getGroup({ constants, parent }),
|
|
@@ -27,8 +29,10 @@ const renderless = (props, { computed, reactive, onMounted, inject, onBeforeUnmo
|
|
|
27
29
|
customEvents({ props, vm, type: "add" });
|
|
28
30
|
});
|
|
29
31
|
onBeforeUnmount(() => {
|
|
32
|
+
api2.unMounted();
|
|
30
33
|
customEvents({ props, vm, type: "remove" });
|
|
31
34
|
});
|
|
35
|
+
watch(() => state.label, api2.mounted);
|
|
32
36
|
return api2;
|
|
33
37
|
};
|
|
34
38
|
export {
|
|
@@ -1,15 +1,52 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
const getChangePosition = (state) => (value) => {
|
|
3
|
-
state.
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const getChangePosition = ({ state }) => (value) => {
|
|
3
|
+
const sliderItem = state.sliderInfo.find((item) => item.value === value);
|
|
4
|
+
if (sliderItem) {
|
|
5
|
+
const { buttonVm, width, left, height } = sliderItem;
|
|
6
|
+
if (!width || !height) {
|
|
7
|
+
sliderItem.left = buttonVm.offsetLeft;
|
|
8
|
+
sliderItem.width = buttonVm.offsetWidth;
|
|
9
|
+
sliderItem.height = buttonVm.offsetHeight;
|
|
6
10
|
}
|
|
11
|
+
state.sliderSpace = sliderItem.left;
|
|
12
|
+
state.sliderWidth = sliderItem.width;
|
|
13
|
+
state.sliderHeight = sliderItem.height;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const watchSliderButtonChange = ({ vm, state, api, props }) => (value) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const observer = new MutationObserver(() => {
|
|
19
|
+
state.sliderInfo.forEach((sliderItem) => {
|
|
20
|
+
const { buttonVm } = sliderItem;
|
|
21
|
+
sliderItem.left = buttonVm.offsetLeft;
|
|
22
|
+
sliderItem.width = buttonVm.offsetWidth;
|
|
23
|
+
sliderItem.height = buttonVm.offsetHeight;
|
|
24
|
+
});
|
|
25
|
+
api.getChangePosition(props.modelValue);
|
|
26
|
+
});
|
|
27
|
+
state.mutationObserver = observer;
|
|
28
|
+
const buttonBox = (_a = vm.$refs) == null ? void 0 : _a.sliderButtonBox;
|
|
29
|
+
if (buttonBox) {
|
|
30
|
+
observer.observe(vm.$refs.sliderButtonBox, { childList: true, subtree: true, characterData: true });
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const watchVisible = ({ vm, api, props, state }) => () => {
|
|
34
|
+
var _a;
|
|
35
|
+
const group = (_a = vm.$refs) == null ? void 0 : _a.sliderButtonGroup;
|
|
36
|
+
if (!group) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const observer = new IntersectionObserver(() => {
|
|
40
|
+
if (!(group == null ? void 0 : group.offsetParent)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
api.getChangePosition(props.modelValue);
|
|
7
44
|
});
|
|
8
|
-
state.
|
|
9
|
-
|
|
10
|
-
state.sliderHeight = state.sliderHeightData[state.currentIndex];
|
|
11
|
-
state.sliderCount += 1;
|
|
45
|
+
state.intersectionObserver = observer;
|
|
46
|
+
observer.observe(group);
|
|
12
47
|
};
|
|
13
48
|
export {
|
|
14
|
-
getChangePosition
|
|
49
|
+
getChangePosition,
|
|
50
|
+
watchSliderButtonChange,
|
|
51
|
+
watchVisible
|
|
15
52
|
};
|
|
@@ -1,46 +1,67 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-G2ADBYYC.js";
|
|
5
|
+
import { getChangePosition, watchVisible, watchSliderButtonChange } from "./index";
|
|
3
6
|
const api = ["state"];
|
|
4
|
-
const renderless = (props, { reactive, provide, onMounted }, { parent }) => {
|
|
7
|
+
const renderless = (props, { reactive, provide, onMounted, onBeforeUnmount, watch }, { parent, vm }) => {
|
|
5
8
|
const state = reactive({
|
|
6
9
|
tag: "div",
|
|
7
10
|
isActive: false,
|
|
8
|
-
eachBlock: [],
|
|
9
11
|
sliderWidth: 0,
|
|
10
12
|
sliderHeight: 0,
|
|
11
13
|
sliderSpace: props.size === "large" ? 4 : 2,
|
|
12
|
-
|
|
13
|
-
sliderHeightData: [],
|
|
14
|
-
eachBlockIndex: [],
|
|
15
|
-
eachBlockData: {},
|
|
14
|
+
sliderInfo: [],
|
|
16
15
|
currentIndex: 0,
|
|
17
|
-
|
|
16
|
+
mutationObserver: null,
|
|
17
|
+
intersectionObserver: null
|
|
18
18
|
});
|
|
19
19
|
parent.$on("handleChange", (value) => {
|
|
20
20
|
api2.getChangePosition(value);
|
|
21
21
|
parent.$emit("change", value);
|
|
22
22
|
});
|
|
23
|
-
parent.$on("
|
|
24
|
-
state.
|
|
23
|
+
parent.$on("eachBlock", (left, width, height, value, buttonVm) => {
|
|
24
|
+
const sliderItem = state.sliderInfo.find((item) => item.buttonVm === buttonVm);
|
|
25
25
|
if (props.modelValue === value) {
|
|
26
26
|
state.isActive = true;
|
|
27
27
|
}
|
|
28
|
+
if (sliderItem) {
|
|
29
|
+
state.sliderInfo[state.sliderInfo.indexOf(sliderItem)] = __spreadProps(__spreadValues({}, sliderItem), { left, width, value, height });
|
|
30
|
+
} else {
|
|
31
|
+
state.sliderInfo.push({ buttonVm, left, width, value, height });
|
|
32
|
+
}
|
|
28
33
|
});
|
|
29
|
-
parent.$on("
|
|
30
|
-
state.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
state.sliderHeight = state.sliderHeightData[0];
|
|
34
|
+
parent.$on("delBlock", (value) => {
|
|
35
|
+
let sliderItem = state.sliderInfo.find((item) => item.value === value);
|
|
36
|
+
if (sliderItem) {
|
|
37
|
+
state.sliderInfo.splice(state.sliderInfo.indexOf(sliderItem), 1);
|
|
38
|
+
}
|
|
35
39
|
});
|
|
36
40
|
const api2 = {};
|
|
37
|
-
Object.assign(api2, {
|
|
41
|
+
Object.assign(api2, {
|
|
42
|
+
state,
|
|
43
|
+
getChangePosition: getChangePosition({ state }),
|
|
44
|
+
watchVisible: watchVisible({ vm, api: api2, props, state }),
|
|
45
|
+
watchSliderButtonChange: watchSliderButtonChange({ vm, state, api: api2, props })
|
|
46
|
+
});
|
|
38
47
|
provide("sliderType", props.type);
|
|
39
48
|
provide("sliderSize", props.size);
|
|
40
49
|
provide("disabled", props.disabled);
|
|
41
50
|
onMounted(() => {
|
|
42
51
|
api2.getChangePosition(props.modelValue);
|
|
52
|
+
api2.watchVisible();
|
|
53
|
+
api2.watchSliderButtonChange();
|
|
43
54
|
});
|
|
55
|
+
onBeforeUnmount(() => {
|
|
56
|
+
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
57
|
+
intersectionObserver == null ? void 0 : intersectionObserver.disconnect();
|
|
58
|
+
});
|
|
59
|
+
watch(
|
|
60
|
+
() => props.modelValue,
|
|
61
|
+
(value) => {
|
|
62
|
+
api2.getChangePosition(value);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
44
65
|
return api2;
|
|
45
66
|
};
|
|
46
67
|
export {
|
package/tab-item-mf/vue.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
|
|
2
|
+
import { useRelation as createUseRelation } from "../common/deps/useRelation";
|
|
3
|
+
const renderless = (props, hooks, { slots, vm }) => {
|
|
4
|
+
const { inject, onBeforeUnmount, reactive, toRef, markRaw } = hooks;
|
|
3
5
|
const tabs = inject("tabs", null);
|
|
6
|
+
const tabsId = inject("tabsId", null);
|
|
7
|
+
const useRelation = createUseRelation(hooks);
|
|
4
8
|
const { lazy } = props;
|
|
5
9
|
const item = reactive({
|
|
6
10
|
title: toRef(props, "title"),
|
|
@@ -15,6 +19,7 @@ const renderless = (props, { inject, onBeforeUnmount, reactive, toRef, markRaw }
|
|
|
15
19
|
item.selected = (tabs.activeName || tabs.modelValue) === item.name;
|
|
16
20
|
tabs.addItem(item);
|
|
17
21
|
onBeforeUnmount(() => tabs.removeItem(item.name, true));
|
|
22
|
+
useRelation({ relationKey: `tabs-${tabsId}` });
|
|
18
23
|
return {};
|
|
19
24
|
};
|
|
20
25
|
export {
|
package/tabs-mf/index.js
CHANGED
|
@@ -49,6 +49,31 @@ const addItem = (state) => (item) => {
|
|
|
49
49
|
const addNav = (state) => (nav) => {
|
|
50
50
|
state.navs = [...state.navs, nav];
|
|
51
51
|
};
|
|
52
|
+
const sortItem = (state) => (names) => {
|
|
53
|
+
const items = [...state.items];
|
|
54
|
+
const navs = [...state.navs];
|
|
55
|
+
items.sort((a, b) => names.indexOf(a.name) - names.indexOf(b.name));
|
|
56
|
+
navs.sort((a, b) => names.indexOf(a.name) - names.indexOf(b.name));
|
|
57
|
+
state.items = items;
|
|
58
|
+
state.navs = navs;
|
|
59
|
+
};
|
|
60
|
+
const onRelationChange = ({ api, instance, nextTick, state }) => () => {
|
|
61
|
+
const itemOrder = instance.childTabs.map((tab) => tab.name);
|
|
62
|
+
const itemOrderKey = itemOrder.join(",");
|
|
63
|
+
const { tabbar } = instance.$refs;
|
|
64
|
+
if (itemOrderKey !== state.itemOrderKey) {
|
|
65
|
+
state.itemOrderKey = itemOrderKey;
|
|
66
|
+
api.sortItem(itemOrder);
|
|
67
|
+
const selectedItem = state.items.find((item) => item.selected);
|
|
68
|
+
if (selectedItem) {
|
|
69
|
+
selectedItem.selected = false;
|
|
70
|
+
nextTick(() => {
|
|
71
|
+
selectedItem.selected = true;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
tabbar.wheelListener();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
52
77
|
const scrollTo = ({ vm, state }) => (name) => {
|
|
53
78
|
const { navs } = state;
|
|
54
79
|
const { $refs } = vm;
|
|
@@ -57,12 +82,10 @@ const scrollTo = ({ vm, state }) => (name) => {
|
|
|
57
82
|
fastdom.measure(() => {
|
|
58
83
|
const { clientWidth, scrollWidth } = scroll;
|
|
59
84
|
if (name && scrollWidth > clientWidth) {
|
|
60
|
-
const total = navs.length;
|
|
61
85
|
const index = navs.findIndex((nav) => nav.name === name);
|
|
62
|
-
const max = scrollWidth - clientWidth;
|
|
63
86
|
if (~index) {
|
|
64
87
|
fastdom.mutate(() => {
|
|
65
|
-
scroll.scrollLeft =
|
|
88
|
+
scroll.scrollLeft = vm.$el.querySelector('[data-tag="tiny-tab-nav"]').childNodes[index].offsetLeft - 5;
|
|
66
89
|
tabbar.wheelListener();
|
|
67
90
|
});
|
|
68
91
|
}
|
|
@@ -206,6 +229,33 @@ const handleNavItemClose = ({ tabs, props }) => (e) => {
|
|
|
206
229
|
e.stopPropagation();
|
|
207
230
|
tabs.removeItem(props.navItem.name);
|
|
208
231
|
};
|
|
232
|
+
const onTouchstart = (state) => (e) => {
|
|
233
|
+
const clientX = e.touches[0].clientX;
|
|
234
|
+
state.last = clientX;
|
|
235
|
+
};
|
|
236
|
+
const onTouchmove = ({ props, state, vm }) => (e) => {
|
|
237
|
+
const { last } = state;
|
|
238
|
+
const { stopThreshold } = props;
|
|
239
|
+
const { touchContainer } = vm.$refs;
|
|
240
|
+
const clientX = e.touches[0].clientX;
|
|
241
|
+
const change = clientX - last;
|
|
242
|
+
state.last = clientX;
|
|
243
|
+
if (touchContainer) {
|
|
244
|
+
if (touchContainer.scrollWidth > touchContainer.clientWidth) {
|
|
245
|
+
touchContainer.scrollLeft -= change;
|
|
246
|
+
}
|
|
247
|
+
const shouldNext = change < 0 && touchContainer.clientWidth + touchContainer.scrollLeft >= touchContainer.scrollWidth - stopThreshold;
|
|
248
|
+
const shouldPrevious = change > 0 && touchContainer.scrollLeft <= stopThreshold;
|
|
249
|
+
if (!shouldNext && !shouldPrevious) {
|
|
250
|
+
e.stopPropagation();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
const clearScroll = (vm) => () => {
|
|
255
|
+
if (vm.$refs.touchContainer) {
|
|
256
|
+
vm.$refs.touchContainer.scrollLeft = 0;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
209
259
|
export {
|
|
210
260
|
addItem,
|
|
211
261
|
addNav,
|
|
@@ -213,6 +263,7 @@ export {
|
|
|
213
263
|
canLeave,
|
|
214
264
|
changeCurrentName,
|
|
215
265
|
clearOtherTabSwipeScroll,
|
|
266
|
+
clearScroll,
|
|
216
267
|
clickMore,
|
|
217
268
|
computedSwipeable,
|
|
218
269
|
emitAdd,
|
|
@@ -223,9 +274,13 @@ export {
|
|
|
223
274
|
handleNavItemClose,
|
|
224
275
|
key,
|
|
225
276
|
observeTabSwipeSize,
|
|
277
|
+
onRelationChange,
|
|
278
|
+
onTouchmove,
|
|
279
|
+
onTouchstart,
|
|
226
280
|
removeItem,
|
|
227
281
|
scrollTo,
|
|
228
282
|
setActive,
|
|
283
|
+
sortItem,
|
|
229
284
|
unobserveTabSwipeSize,
|
|
230
285
|
wheelListener
|
|
231
286
|
};
|
package/tabs-mf/vue-bar.js
CHANGED
|
@@ -33,12 +33,6 @@ const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject
|
|
|
33
33
|
state.moreOptions = state.moreList.map((name) => tabs.state.items.find((item) => item.name === name));
|
|
34
34
|
}
|
|
35
35
|
);
|
|
36
|
-
watch(
|
|
37
|
-
() => tabs.state.navs,
|
|
38
|
-
() => {
|
|
39
|
-
api2.wheelListener();
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
36
|
onMounted(() => {
|
|
43
37
|
addWheelListener(vm.$refs.scroll, api2.wheelListener);
|
|
44
38
|
addResizeListener(vm.$el, api2.wheelListener);
|