@opentiny/vue-renderless 3.14.0 → 3.15.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/LICENSE +22 -0
- package/action-menu/index.js +44 -0
- package/action-menu/vue.js +25 -8
- package/calendar-view/index.js +21 -13
- package/calendar-view/vue.js +6 -3
- package/cascader/index.js +1 -1
- package/cascader-select/index.js +5 -0
- package/cascader-select/vue.js +3 -1
- package/common/bigInt.js +2 -2
- package/common/deps/date-util.js +4 -2
- package/common/deps/vue-popper.js +22 -2
- package/common/index.js +15 -2
- package/common/runtime.js +1 -1
- package/date-range/vue.js +1 -0
- package/date-table/index.js +30 -53
- package/date-table/vue.js +1 -1
- package/dept/index.js +8 -1
- package/dept/vue.js +10 -1
- package/dialog-box/index.js +12 -6
- package/dialog-box/vue.js +1 -1
- package/dropdown-item/mf.js +2 -2
- package/file-upload/index.js +0 -1
- package/grid/utils/dom.js +30 -10
- package/image/index.js +4 -0
- package/image/vue.js +6 -3
- package/image-viewer/vue.js +3 -1
- package/input/index.js +6 -1
- package/input/vue.js +9 -5
- package/modal/index.js +1 -1
- package/numeric/index.js +9 -20
- package/numeric/vue.js +3 -12
- package/option-group/index.js +13 -0
- package/option-group/vue.js +19 -6
- package/package.json +7 -7
- package/picker/index.js +218 -193
- package/picker/vue.js +7 -4
- package/popconfirm/index.js +6 -0
- package/popconfirm/vue.js +11 -3
- package/popeditor/index.js +2 -2
- package/popover/index.js +4 -1
- package/popover/vue.js +2 -1
- package/quarter-panel/index.js +61 -0
- package/quarter-panel/vue.js +46 -0
- package/select/index.js +111 -55
- package/select/vue.js +53 -19
- package/skeleton/vue.js +2 -2
- package/skeleton-item/vue.js +1 -1
- package/statistic/index.js +22 -0
- package/statistic/vue.js +20 -0
- package/tabs/index.js +16 -1
- package/tall-storage/index.js +1 -1
- package/time-picker-mobile/index.js +10 -1
- package/time-picker-mobile/vue.js +5 -3
- package/time-spinner/index.js +52 -1
- package/time-spinner/vue.js +4 -2
- package/timeline-item/index.js +14 -1
- package/timeline-item/vue.js +7 -4
- package/tree/index.js +8 -4
- package/tree/vue.js +3 -3
- package/tree-node/index.js +2 -2
- package/types/action-menu.type.d.ts +40 -12
- package/types/action-sheet.type.d.ts +2 -2
- package/types/alert.type.d.ts +1 -1
- package/types/checkbox.type.d.ts +3 -3
- package/types/collapse.type.d.ts +1 -1
- package/types/date-table.type.d.ts +13 -0
- package/types/dialog-box.type.d.ts +1 -1
- package/types/drawer.type.d.ts +1 -1
- package/types/{dropdown-item.type-8475a549.d.ts → dropdown-item.type-678794c9.d.ts} +4 -0
- package/types/dropdown-item.type.d.ts +1 -1
- package/types/dropdown-menu.type.d.ts +1 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/form-item.type.d.ts +1 -1
- package/types/{form.type-222799ae.d.ts → form.type-8e30b25c.d.ts} +2 -1
- package/types/form.type.d.ts +1 -1
- package/types/image.type.d.ts +4 -0
- package/types/input.type.d.ts +3 -1
- package/types/milestone.type.d.ts +1 -1
- package/types/numeric.type.d.ts +4 -5
- package/types/pager.type.d.ts +1 -1
- package/types/popconfirm.type.d.ts +8 -0
- package/types/popeditor.type.d.ts +1 -1
- package/types/popover.type.d.ts +3 -3
- package/types/progress.type.d.ts +1 -1
- package/types/skeleton.type.d.ts +1 -1
- package/types/statistic.type.d.ts +56 -0
- package/types/steps.type.d.ts +1 -1
- package/types/switch.type.d.ts +3 -3
- package/types/tag.type.d.ts +4 -1
- package/types/{time-line.type-b155cb4f.d.ts → time-line.type-1b501c41.d.ts} +7 -0
- package/types/time-line.type.d.ts +1 -1
- package/types/timeline-item.type.d.ts +1 -1
- package/types/transfer.type.d.ts +3 -3
- package/types/upload-dragger.type.d.ts +2 -2
- package/types/{upload-list.type-a29aea50.d.ts → upload-list.type-f34997c8.d.ts} +9 -5
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/user/index.js +1 -1
- package/credit-card/index.js +0 -93
- package/credit-card/vue.js +0 -62
- package/credit-card-form/index.js +0 -112
- package/credit-card-form/vue.js +0 -119
- package/detail-page/index.js +0 -79
- package/detail-page/vue.js +0 -78
- package/slide-bar/index.js +0 -67
- package/slide-bar/vue.js +0 -32
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadProps,
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "../chunk-G2ADBYYC.js";
|
|
5
|
-
const generateMonthValue = (month) => month < 10 ? `0${month}` : month;
|
|
6
|
-
const changeName = ({ emit, state }) => (event) => {
|
|
7
|
-
state.formData.cardName = event.target.value;
|
|
8
|
-
emit("input-card-name", state.formData.cardName);
|
|
9
|
-
};
|
|
10
|
-
const changeNumber = ({ emit, state }) => (event) => {
|
|
11
|
-
state.formData.cardNumber = event.target.value;
|
|
12
|
-
state.mainCardNumber = event.target.value;
|
|
13
|
-
let value = state.formData.cardNumber.replace(/\D/g, "");
|
|
14
|
-
if (/^3[47]\d{0,13}$/.test(value)) {
|
|
15
|
-
state.formData.cardNumber = value.replace(/^(\d{4})(?=\d)/, "$1 ").replace(/^(\d{4}) (\d{6})(?=\d)/, "$1 $2 ");
|
|
16
|
-
state.cardNumberMaxLength = 17;
|
|
17
|
-
} else if (/^3(?:0[0-5]|[68]\d)\d{0,11}$/.test(value)) {
|
|
18
|
-
state.formData.cardNumber = value.replace(/^(\d{4})(?=\d)/, "$1 ").replace(/^(\d{4}) (\d{6})(?=\d)/, "$1 $2 ");
|
|
19
|
-
state.cardNumberMaxLength = 16;
|
|
20
|
-
} else if (/^\d{0,16}$/.test(value)) {
|
|
21
|
-
state.formData.cardNumber = value.replace(/^(\d{4})(?=\d)/, "$1 ").replace(/^(\d{4}) (\d{4})(?=\d)/, "$1 $2 ").replace(/^(\d{4}) (\d{4}) (\d{4})(?=\d)/, "$1 $2 $3 ");
|
|
22
|
-
state.cardNumberMaxLength = 19;
|
|
23
|
-
}
|
|
24
|
-
emit("input-card-number", state.formData.cardNumber);
|
|
25
|
-
};
|
|
26
|
-
const changeMonth = ({ emit, state }) => () => {
|
|
27
|
-
emit("input-card-month", state.cardMonth);
|
|
28
|
-
};
|
|
29
|
-
const changeYear = ({ emit, state }) => () => {
|
|
30
|
-
emit("input-card-year", state.cardYear);
|
|
31
|
-
};
|
|
32
|
-
const changeCvv = ({ emit, state }) => (event) => {
|
|
33
|
-
state.formData.cardCvv = event.target.value;
|
|
34
|
-
emit("input-card-cvv", state.formData.cardCvv);
|
|
35
|
-
};
|
|
36
|
-
const invaildCard = (props) => () => {
|
|
37
|
-
let number = props.formData.cardNumber;
|
|
38
|
-
let sum = 0;
|
|
39
|
-
let isOdd = true;
|
|
40
|
-
if (!number) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
for (let i = number.length - 1; i >= 0; i--) {
|
|
44
|
-
let code = number.charAt(i);
|
|
45
|
-
if (isOdd) {
|
|
46
|
-
sum += code;
|
|
47
|
-
} else {
|
|
48
|
-
code = code * 2;
|
|
49
|
-
if (code > 9) {
|
|
50
|
-
code = code.toString().split("").join("+");
|
|
51
|
-
}
|
|
52
|
-
sum += code;
|
|
53
|
-
}
|
|
54
|
-
isOdd = !isOdd;
|
|
55
|
-
}
|
|
56
|
-
if (sum % 10 !== 0) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
};
|
|
61
|
-
const handleSubmit = ({ api, emit, props, state }) => () => {
|
|
62
|
-
const invaildCard2 = api.invaildCard();
|
|
63
|
-
emit("submit", __spreadProps(__spreadValues({
|
|
64
|
-
invaildCard: invaildCard2
|
|
65
|
-
}, props.formData), {
|
|
66
|
-
cardNumber: state.mainCardNumber.replace(/ /g, "")
|
|
67
|
-
}));
|
|
68
|
-
};
|
|
69
|
-
const blurCardNumber = ({ api, state }) => () => {
|
|
70
|
-
if (state.isCardNumberMasked) {
|
|
71
|
-
api.maskCardNumber();
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const maskCardNumber = ({ props, state }) => () => {
|
|
75
|
-
state.mainCardNumber = props.formData.cardNumber;
|
|
76
|
-
let arr = props.formData.cardNumber.split("");
|
|
77
|
-
arr.forEach((element, index) => {
|
|
78
|
-
if (index > 4 && index < 14 && element.trim() !== "") {
|
|
79
|
-
arr[index] = "*";
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
props.formData.cardNumber = arr.join("");
|
|
83
|
-
};
|
|
84
|
-
const unMaskCardNumber = ({ props, state }) => () => {
|
|
85
|
-
props.formData.cardNumber = state.mainCardNumber;
|
|
86
|
-
};
|
|
87
|
-
const focusCardNumber = (api) => () => {
|
|
88
|
-
api.unMaskCardNumber();
|
|
89
|
-
};
|
|
90
|
-
const toggleMask = ({ api, state }) => () => {
|
|
91
|
-
state.isCardNumberMasked = !state.isCardNumberMasked;
|
|
92
|
-
if (state.isCardNumberMasked) {
|
|
93
|
-
api.maskCardNumber();
|
|
94
|
-
} else {
|
|
95
|
-
api.unMaskCardNumber();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
export {
|
|
99
|
-
blurCardNumber,
|
|
100
|
-
changeCvv,
|
|
101
|
-
changeMonth,
|
|
102
|
-
changeName,
|
|
103
|
-
changeNumber,
|
|
104
|
-
changeYear,
|
|
105
|
-
focusCardNumber,
|
|
106
|
-
generateMonthValue,
|
|
107
|
-
handleSubmit,
|
|
108
|
-
invaildCard,
|
|
109
|
-
maskCardNumber,
|
|
110
|
-
toggleMask,
|
|
111
|
-
unMaskCardNumber
|
|
112
|
-
};
|
package/credit-card-form/vue.js
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import {
|
|
3
|
-
generateMonthValue,
|
|
4
|
-
changeName,
|
|
5
|
-
changeNumber,
|
|
6
|
-
changeMonth,
|
|
7
|
-
changeYear,
|
|
8
|
-
changeCvv,
|
|
9
|
-
invaildCard,
|
|
10
|
-
blurCardNumber,
|
|
11
|
-
maskCardNumber,
|
|
12
|
-
unMaskCardNumber,
|
|
13
|
-
focusCardNumber,
|
|
14
|
-
toggleMask,
|
|
15
|
-
handleSubmit
|
|
16
|
-
} from "./index";
|
|
17
|
-
const api = [
|
|
18
|
-
"state",
|
|
19
|
-
"generateMonthValue",
|
|
20
|
-
"changeName",
|
|
21
|
-
"changeNumber",
|
|
22
|
-
"changeMonth",
|
|
23
|
-
"changeYear",
|
|
24
|
-
"changeCvv",
|
|
25
|
-
"invaildCard",
|
|
26
|
-
"blurCardNumber",
|
|
27
|
-
"maskCardNumber",
|
|
28
|
-
"unMaskCardNumber",
|
|
29
|
-
"focusCardNumber",
|
|
30
|
-
"toggleMask",
|
|
31
|
-
"handleSubmit"
|
|
32
|
-
];
|
|
33
|
-
const initState = ({ reactive, props, computed }) => {
|
|
34
|
-
const state = reactive({
|
|
35
|
-
fields: {
|
|
36
|
-
cardCvv: "v-card-cvv",
|
|
37
|
-
cardName: "v-card-name",
|
|
38
|
-
cardYear: "v-card-year",
|
|
39
|
-
cardMonth: "v-card-month",
|
|
40
|
-
cardNumber: "v-card-number"
|
|
41
|
-
},
|
|
42
|
-
minCardYear: (/* @__PURE__ */ new Date()).getFullYear(),
|
|
43
|
-
isCardNumberMasked: true,
|
|
44
|
-
mainCardNumber: props.formData.cardNumber,
|
|
45
|
-
cardNumberMaxLength: 19,
|
|
46
|
-
cardMonth: props.formData.cardMonth,
|
|
47
|
-
cardYear: props.formData.cardYear,
|
|
48
|
-
formData: props.formData,
|
|
49
|
-
minCardMonth: computed(() => props.formData.cardYear === state.minCardYear ? (/* @__PURE__ */ new Date()).getMonth() + 1 : 1)
|
|
50
|
-
});
|
|
51
|
-
return state;
|
|
52
|
-
};
|
|
53
|
-
const initApi = ({ api: api2, state, emit, props }) => {
|
|
54
|
-
Object.assign(api2, {
|
|
55
|
-
state,
|
|
56
|
-
generateMonthValue,
|
|
57
|
-
changeCvv: changeCvv({ emit, state }),
|
|
58
|
-
changeYear: changeYear({ emit, state }),
|
|
59
|
-
changeName: changeName({ emit, state }),
|
|
60
|
-
invaildCard: invaildCard(props),
|
|
61
|
-
changeMonth: changeMonth({ emit, state }),
|
|
62
|
-
changeNumber: changeNumber({ emit, state }),
|
|
63
|
-
maskCardNumber: maskCardNumber({ props, state }),
|
|
64
|
-
unMaskCardNumber: unMaskCardNumber({ props, state }),
|
|
65
|
-
toggleMask: toggleMask({ api: api2, state }),
|
|
66
|
-
handleSubmit: handleSubmit({ api: api2, emit, props, state }),
|
|
67
|
-
blurCardNumber: blurCardNumber({ api: api2, state }),
|
|
68
|
-
focusCardNumber: focusCardNumber(api2)
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
const initWatch = ({ watch, state, props, emit }) => {
|
|
72
|
-
watch(
|
|
73
|
-
() => state.cardYear,
|
|
74
|
-
(value) => {
|
|
75
|
-
state.formData.cardYear = value;
|
|
76
|
-
emit("update:formData", state.formData);
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
watch(
|
|
80
|
-
() => state.formData.cardNumber,
|
|
81
|
-
() => emit("update:formData", state.formData)
|
|
82
|
-
);
|
|
83
|
-
watch(
|
|
84
|
-
() => state.formData.cardName,
|
|
85
|
-
() => emit("update:formData", state.formData)
|
|
86
|
-
);
|
|
87
|
-
watch(
|
|
88
|
-
() => state.formData.cardCvv,
|
|
89
|
-
() => emit("update:formData", state.formData)
|
|
90
|
-
);
|
|
91
|
-
watch(
|
|
92
|
-
() => state.cardMonth,
|
|
93
|
-
(value) => {
|
|
94
|
-
state.formData.cardMonth = value;
|
|
95
|
-
emit("update:formData", state.formData);
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
watch(
|
|
99
|
-
() => props.formData.cardYear,
|
|
100
|
-
() => {
|
|
101
|
-
if (props.formData.cardMonth < state.minCardMonth) {
|
|
102
|
-
state.cardMonth = "";
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
{ immediate: true }
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
const renderless = (props, { computed, onMounted, reactive, watch }, { emit }) => {
|
|
109
|
-
const api2 = {};
|
|
110
|
-
const state = initState({ reactive, props, computed });
|
|
111
|
-
initApi({ api: api2, state, emit, props });
|
|
112
|
-
onMounted(api2.maskCardNumber);
|
|
113
|
-
initWatch({ watch, state, props, emit });
|
|
114
|
-
return api2;
|
|
115
|
-
};
|
|
116
|
-
export {
|
|
117
|
-
api,
|
|
118
|
-
renderless
|
|
119
|
-
};
|
package/detail-page/index.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__spreadProps,
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "../chunk-G2ADBYYC.js";
|
|
5
|
-
const computedCancel = ({ constants, props, t }) => () => props.cancelButton || t(constants.CANCEL_BUTTTON_TEXT);
|
|
6
|
-
const computedconfirm = ({ constants, props, t }) => () => props.saveButton || t(constants.SAVE_BUTTON_TEXT);
|
|
7
|
-
const computedSetLocalTips = ({ constants, props, t }) => () => props.tips || t(constants.LOCAL_TIPS);
|
|
8
|
-
const computedSetValueTitle = ({ constants, props, t }) => () => props.valueTitle || t(constants.VALUE_TITLE);
|
|
9
|
-
const computedSetLocalTitle = ({ constants, props, t }) => () => props.title || t(constants.LOCAL_TITLE);
|
|
10
|
-
const computedSetLabelTitle = ({ constants, props, t }) => () => props.labelTitle || t(constants.LABEL_TITLE);
|
|
11
|
-
const computedSetDialogTitle = ({ constants, props, t }) => () => props.dialogTitle || t(constants.DIALOG_TITLE);
|
|
12
|
-
const showDialog = (state) => () => {
|
|
13
|
-
state.isShowDialog = true;
|
|
14
|
-
state.cloneValue = state.value.map((item) => {
|
|
15
|
-
if (item.hidden != void 0) {
|
|
16
|
-
return __spreadValues({}, item);
|
|
17
|
-
} else {
|
|
18
|
-
return __spreadProps(__spreadValues({}, item), { hidden: false });
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
const closeDialog = (state) => () => {
|
|
23
|
-
state.isShowDialog = false;
|
|
24
|
-
};
|
|
25
|
-
const checkAllHander = (state) => () => state.cloneValue = state.cloneValue.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
26
|
-
hidden: state.checkAll
|
|
27
|
-
}));
|
|
28
|
-
const checkValueHiddenItem = (state) => (index) => {
|
|
29
|
-
let hiddenItemCount = 0;
|
|
30
|
-
if (typeof index === "number") {
|
|
31
|
-
state.cloneValue[index].hidden = !state.cloneValue[index].hidden;
|
|
32
|
-
}
|
|
33
|
-
state.cloneValue.forEach((item) => {
|
|
34
|
-
if (item.hidden) {
|
|
35
|
-
++hiddenItemCount;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
if (hiddenItemCount > 0 && hiddenItemCount < state.cloneValue.length) {
|
|
39
|
-
state.checkAll = false;
|
|
40
|
-
return true;
|
|
41
|
-
} else if (hiddenItemCount === 0) {
|
|
42
|
-
state.checkAll = false;
|
|
43
|
-
return false;
|
|
44
|
-
} else if (hiddenItemCount === state.cloneValue.length) {
|
|
45
|
-
state.checkAll = true;
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
const saveHandler = ({ emit, state, alert }) => () => {
|
|
50
|
-
if (state.checkAll) {
|
|
51
|
-
alert({ message: state.tips, title: "", status: "warning" });
|
|
52
|
-
emit("saveWarning");
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
state.value = state.cloneValue;
|
|
56
|
-
state.isShowDialog = false;
|
|
57
|
-
};
|
|
58
|
-
const watchValue = (state) => (value) => {
|
|
59
|
-
state.value = value;
|
|
60
|
-
};
|
|
61
|
-
const watchTextSplit = (state) => (value) => {
|
|
62
|
-
state.textSplit = value;
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
checkAllHander,
|
|
66
|
-
checkValueHiddenItem,
|
|
67
|
-
closeDialog,
|
|
68
|
-
computedCancel,
|
|
69
|
-
computedSetDialogTitle,
|
|
70
|
-
computedSetLabelTitle,
|
|
71
|
-
computedSetLocalTips,
|
|
72
|
-
computedSetLocalTitle,
|
|
73
|
-
computedSetValueTitle,
|
|
74
|
-
computedconfirm,
|
|
75
|
-
saveHandler,
|
|
76
|
-
showDialog,
|
|
77
|
-
watchTextSplit,
|
|
78
|
-
watchValue
|
|
79
|
-
};
|
package/detail-page/vue.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import {
|
|
3
|
-
watchTextSplit,
|
|
4
|
-
watchValue,
|
|
5
|
-
showDialog,
|
|
6
|
-
saveHandler,
|
|
7
|
-
checkAllHander,
|
|
8
|
-
checkValueHiddenItem,
|
|
9
|
-
closeDialog,
|
|
10
|
-
computedCancel,
|
|
11
|
-
computedconfirm,
|
|
12
|
-
computedSetLocalTips,
|
|
13
|
-
computedSetValueTitle,
|
|
14
|
-
computedSetLocalTitle,
|
|
15
|
-
computedSetLabelTitle,
|
|
16
|
-
computedSetDialogTitle
|
|
17
|
-
} from "./index";
|
|
18
|
-
const api = [
|
|
19
|
-
"state",
|
|
20
|
-
"valueChange",
|
|
21
|
-
"showDialog",
|
|
22
|
-
"closeDialog",
|
|
23
|
-
"checkAllHander",
|
|
24
|
-
"saveHandler",
|
|
25
|
-
"checkValueHiddenItem"
|
|
26
|
-
];
|
|
27
|
-
const initState = ({ reactive, computed, api: api2, props }) => {
|
|
28
|
-
const state = reactive({
|
|
29
|
-
value: props.modelValue,
|
|
30
|
-
cloneValue: props.modelValue,
|
|
31
|
-
textSplit: props.textSplit,
|
|
32
|
-
isShowDialog: false,
|
|
33
|
-
checkAll: false,
|
|
34
|
-
indeterminate: computed(() => api2.checkValueHiddenItem()),
|
|
35
|
-
tips: computed(() => api2.computedSetLocalTips()),
|
|
36
|
-
saveButton: computed(() => api2.computedconfirm()),
|
|
37
|
-
cancelButton: computed(() => api2.computedCancel()),
|
|
38
|
-
title: computed(() => api2.computedSetLocalTitle()),
|
|
39
|
-
labelTitle: computed(() => api2.computedSetLabelTitle()),
|
|
40
|
-
valueTitle: computed(() => api2.computedSetValueTitle()),
|
|
41
|
-
dialogTitle: computed(() => api2.computedSetDialogTitle())
|
|
42
|
-
});
|
|
43
|
-
return state;
|
|
44
|
-
};
|
|
45
|
-
const initApi = ({ api: api2, state, emit, alert, constants, props, t }) => {
|
|
46
|
-
Object.assign(api2, {
|
|
47
|
-
state,
|
|
48
|
-
watchValue: watchValue(state),
|
|
49
|
-
showDialog: showDialog(state),
|
|
50
|
-
closeDialog: closeDialog(state),
|
|
51
|
-
watchTextSplit: watchTextSplit(state),
|
|
52
|
-
checkAllHander: checkAllHander(state),
|
|
53
|
-
saveHandler: saveHandler({ emit, state, alert }),
|
|
54
|
-
checkValueHiddenItem: checkValueHiddenItem(state),
|
|
55
|
-
computedCancel: computedCancel({ constants, props, t }),
|
|
56
|
-
computedconfirm: computedconfirm({ constants, props, t }),
|
|
57
|
-
computedSetLocalTips: computedSetLocalTips({ constants, props, t }),
|
|
58
|
-
computedSetValueTitle: computedSetValueTitle({ constants, props, t }),
|
|
59
|
-
computedSetLocalTitle: computedSetLocalTitle({ constants, props, t }),
|
|
60
|
-
computedSetLabelTitle: computedSetLabelTitle({ constants, props, t }),
|
|
61
|
-
computedSetDialogTitle: computedSetDialogTitle({ api: api2, constants, props, t })
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
const initWatch = ({ watch, props, api: api2 }) => {
|
|
65
|
-
watch(() => props.modelValue, api2.watchValue, { immediate: true });
|
|
66
|
-
watch(() => props.textSplit, api2.watchTextSplit, { immediate: true });
|
|
67
|
-
};
|
|
68
|
-
const renderless = (props, { computed, reactive, watch }, { t, emit, constants }, { alert }) => {
|
|
69
|
-
const api2 = {};
|
|
70
|
-
const state = initState({ reactive, computed, api: api2, props });
|
|
71
|
-
initApi({ api: api2, state, emit, alert, constants, props, t });
|
|
72
|
-
initWatch({ watch, props, api: api2 });
|
|
73
|
-
return api2;
|
|
74
|
-
};
|
|
75
|
-
export {
|
|
76
|
-
api,
|
|
77
|
-
renderless
|
|
78
|
-
};
|
package/slide-bar/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { emitEvent } from "../common/event";
|
|
3
|
-
const leftClick = ({ api, props, vm, state }) => () => {
|
|
4
|
-
if (state.leftLength >= 0) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
state.leftLength = state.leftLength + (state.blockWidth + state.blockMargin) * props.wheelBlocks;
|
|
8
|
-
vm.$refs.insider.style.left = state.leftLength + "px";
|
|
9
|
-
api.changeState();
|
|
10
|
-
};
|
|
11
|
-
const rightClick = ({ api, props, vm, state }) => () => {
|
|
12
|
-
if (state.blockWrapper < Math.abs(state.leftLength) + state.wrapperWidth) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
state.leftLength = state.leftLength - (state.blockWidth + state.blockMargin) * props.wheelBlocks;
|
|
16
|
-
vm.$refs.insider.style.left = state.leftLength + "px";
|
|
17
|
-
api.changeState();
|
|
18
|
-
};
|
|
19
|
-
const blockClick = ({ emit, state }) => ({ item, index }) => {
|
|
20
|
-
if (!emitEvent(emit, "before-click")) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
state.currentIndex = index;
|
|
24
|
-
emit("click", item, index);
|
|
25
|
-
};
|
|
26
|
-
const changeState = ({ state }) => () => {
|
|
27
|
-
const contentWidth = state.blockWrapper;
|
|
28
|
-
state.showLeft = !(parseInt(state.leftLength, 10) >= 0);
|
|
29
|
-
state.showRight = contentWidth <= Math.abs(state.leftLength) + state.wrapperWidth;
|
|
30
|
-
};
|
|
31
|
-
const mouseEvent = ({ api, state }) => (e) => {
|
|
32
|
-
if (e.wheelDelta >= 0) {
|
|
33
|
-
if (state.leftLength < 0) {
|
|
34
|
-
api.leftClick();
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
if (state.blockWrapper > Math.abs(state.leftLength) + state.wrapperWidth) {
|
|
38
|
-
api.rightClick();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const changeSize = ({ props, state, vm }) => () => {
|
|
43
|
-
state.wrapperWidth = vm.$refs.wrapper.offsetWidth;
|
|
44
|
-
state.blockWidth = parseInt((1 - (props.initBlocks - 1) * 0.02) / props.initBlocks * state.wrapperWidth, 10);
|
|
45
|
-
state.blockMargin = parseInt(state.wrapperWidth * 0.02, 10);
|
|
46
|
-
state.blockWrapper = props.modelValue.length * state.blockWidth + (props.modelValue.length - 1) * state.blockMargin;
|
|
47
|
-
};
|
|
48
|
-
const swipeleft = ({ api, state }) => () => {
|
|
49
|
-
if (state.blockWrapper > Math.abs(state.leftLength) + state.wrapperWidth) {
|
|
50
|
-
api.rightClick();
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const swiperight = ({ api, state }) => () => {
|
|
54
|
-
if (state.leftLength < 0) {
|
|
55
|
-
api.leftClick();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
export {
|
|
59
|
-
blockClick,
|
|
60
|
-
changeSize,
|
|
61
|
-
changeState,
|
|
62
|
-
leftClick,
|
|
63
|
-
mouseEvent,
|
|
64
|
-
rightClick,
|
|
65
|
-
swipeleft,
|
|
66
|
-
swiperight
|
|
67
|
-
};
|
package/slide-bar/vue.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { leftClick, rightClick, blockClick, changeState, changeSize, mouseEvent } from "./index";
|
|
3
|
-
const api = ["state", "mouseEvent", "rightClick", "leftClick", "blockClick"];
|
|
4
|
-
const renderless = (props, { onMounted, reactive }, { vm, parent, emit }) => {
|
|
5
|
-
const api2 = {};
|
|
6
|
-
const state = reactive({
|
|
7
|
-
leftLength: 0,
|
|
8
|
-
blockWidth: 0,
|
|
9
|
-
blockMargin: 0,
|
|
10
|
-
showLeft: false,
|
|
11
|
-
showRight: false,
|
|
12
|
-
blockWrapper: 0,
|
|
13
|
-
wrapperWidth: 0,
|
|
14
|
-
currentIndex: -1,
|
|
15
|
-
offsetWidth: 0
|
|
16
|
-
});
|
|
17
|
-
Object.assign(api2, {
|
|
18
|
-
state,
|
|
19
|
-
blockClick: blockClick({ emit, state }),
|
|
20
|
-
changeState: changeState({ props, state }),
|
|
21
|
-
changeSize: changeSize({ props, vm, state }),
|
|
22
|
-
leftClick: leftClick({ api: api2, props, vm, state }),
|
|
23
|
-
mouseEvent: mouseEvent({ api: api2, props, vm, state }),
|
|
24
|
-
rightClick: rightClick({ api: api2, parent, props, vm, state })
|
|
25
|
-
});
|
|
26
|
-
onMounted(api2.changeSize);
|
|
27
|
-
return api2;
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
api,
|
|
31
|
-
renderless
|
|
32
|
-
};
|