@opentiny/vue-renderless 3.8.4 → 3.9.1
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/alert/index.js +2 -2
- package/alert/vue.js +3 -3
- package/anchor/index.js +28 -19
- package/anchor/vue.js +3 -2
- package/button-group/index.js +6 -0
- package/button-group/vue.js +8 -3
- package/carousel/index.js +18 -20
- package/carousel/vue.js +29 -5
- package/carousel-item/index.js +2 -1
- package/carousel-item/vue.js +14 -2
- package/cascader/index.js +110 -11
- package/cascader/vue.js +35 -12
- package/chart-heatmap/index.js +12 -12
- package/checkbox/index.js +19 -6
- package/checkbox/vue.js +38 -20
- package/common/bigInt.js +2 -1
- package/common/browser.js +43 -37
- package/common/deps/ResizeObserver.js +2 -2
- package/common/deps/popper.js +26 -24
- package/common/validate/util.js +2 -2
- package/drawer/index.js +16 -1
- package/drawer/vue.js +14 -3
- package/dropdown-menu/index.js +3 -0
- package/dropdown-menu/vue.js +20 -2
- package/grid/utils/dom.js +2 -2
- package/image/vue.js +12 -1
- package/input/index.js +15 -3
- package/input/vue.js +34 -8
- package/ip-address/index.js +4 -4
- package/month-table/index.js +5 -2
- package/numeric/index.js +6 -3
- package/numeric/vue.js +15 -4
- package/package.json +8 -1
- package/popconfirm/index.js +1 -0
- package/popconfirm/vue.js +4 -2
- package/popover/index.js +19 -12
- package/popover/vue.js +15 -5
- package/progress/index.js +44 -6
- package/progress/vue.js +15 -4
- package/radio/index.js +2 -0
- package/radio/vue.js +3 -0
- package/record/index.js +166 -59
- package/record/vue.js +31 -14
- package/roles/index.js +5 -5
- package/roles/vue.js +1 -1
- package/slider/index.js +3 -1
- package/steps/index.js +8 -0
- package/steps/vue.js +3 -2
- package/tabs-mf/vue-bar.js +1 -1
- package/text-popup/vue.js +2 -1
- package/time-line/index.js +8 -0
- package/time-line/vue.js +2 -1
- package/tooltip/index.js +35 -25
- package/tooltip/vue.js +1 -1
- package/tree/index.js +1 -1
- package/user-head/vue.js +8 -1
package/image/vue.js
CHANGED
|
@@ -15,7 +15,18 @@ import {
|
|
|
15
15
|
mounted,
|
|
16
16
|
deleteHander
|
|
17
17
|
} from "./index";
|
|
18
|
-
const api = [
|
|
18
|
+
const api = [
|
|
19
|
+
"state",
|
|
20
|
+
"src",
|
|
21
|
+
"zIndex",
|
|
22
|
+
"previewSrcList",
|
|
23
|
+
"loadImage",
|
|
24
|
+
"clickHandler",
|
|
25
|
+
"closeViewer",
|
|
26
|
+
"handleLoad",
|
|
27
|
+
"handleError",
|
|
28
|
+
"deleteHander"
|
|
29
|
+
];
|
|
19
30
|
const initState = ({ reactive, computed, api: api2, props, images }) => {
|
|
20
31
|
const state = reactive({
|
|
21
32
|
mfPreviewVisible: props.previewVisible,
|
package/input/index.js
CHANGED
|
@@ -46,7 +46,7 @@ const calculateNodeStyling = () => (targetElement) => {
|
|
|
46
46
|
const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
|
|
47
47
|
return { contextStyle, paddingSize, borderSize, boxSizing };
|
|
48
48
|
};
|
|
49
|
-
const calcTextareaHeight = ({ api, hiddenTextarea, props }) => (targetElement, minRows = 1, maxRows = null) => {
|
|
49
|
+
const calcTextareaHeight = ({ api, hiddenTextarea, props, state }) => (targetElement, minRows = 1, maxRows = null) => {
|
|
50
50
|
if (!hiddenTextarea) {
|
|
51
51
|
hiddenTextarea = document.createElement("textarea");
|
|
52
52
|
document.body.appendChild(hiddenTextarea);
|
|
@@ -74,8 +74,12 @@ const calcTextareaHeight = ({ api, hiddenTextarea, props }) => (targetElement, m
|
|
|
74
74
|
if (props.height) {
|
|
75
75
|
minHeight = props.height;
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
if (!state.isDisplayOnly) {
|
|
78
|
+
height = Math.max(minHeight, height);
|
|
79
|
+
textareaStyle.minHeight = `${minHeight}px`;
|
|
80
|
+
} else {
|
|
81
|
+
textareaStyle.minHeight = `0px`;
|
|
82
|
+
}
|
|
79
83
|
}
|
|
80
84
|
if (maxRows !== null) {
|
|
81
85
|
let maxHeight = singleRowHeight * maxRows;
|
|
@@ -250,6 +254,12 @@ const getDisplayedValue = ({ state, props }) => () => {
|
|
|
250
254
|
return props.displayOnlyContent || state.nativeInputValue || "-";
|
|
251
255
|
}
|
|
252
256
|
};
|
|
257
|
+
const handleDrop = (emit) => (event) => {
|
|
258
|
+
emit("drop", event);
|
|
259
|
+
};
|
|
260
|
+
const handleDragStart = (emit) => (event) => {
|
|
261
|
+
emit("dragstart", event);
|
|
262
|
+
};
|
|
253
263
|
export {
|
|
254
264
|
blur,
|
|
255
265
|
calcIconOffset,
|
|
@@ -266,6 +276,8 @@ export {
|
|
|
266
276
|
handleCompositionEnd,
|
|
267
277
|
handleCompositionStart,
|
|
268
278
|
handleCompositionUpdate,
|
|
279
|
+
handleDragStart,
|
|
280
|
+
handleDrop,
|
|
269
281
|
handleEnterDisplayOnlyContent,
|
|
270
282
|
handleFocus,
|
|
271
283
|
handleInput,
|
package/input/vue.js
CHANGED
|
@@ -30,7 +30,9 @@ import {
|
|
|
30
30
|
handleEnterDisplayOnlyContent,
|
|
31
31
|
hiddenPassword,
|
|
32
32
|
dispatchDisplayedValue,
|
|
33
|
-
getDisplayedValue
|
|
33
|
+
getDisplayedValue,
|
|
34
|
+
handleDrop,
|
|
35
|
+
handleDragStart
|
|
34
36
|
} from "./index";
|
|
35
37
|
import useStorageBox from "../tall-storage/vue-storage-box";
|
|
36
38
|
const api = [
|
|
@@ -63,7 +65,9 @@ const api = [
|
|
|
63
65
|
"isMemoryStorage",
|
|
64
66
|
"hasSelection",
|
|
65
67
|
"handleEnterDisplayOnlyContent",
|
|
66
|
-
"hiddenPassword"
|
|
68
|
+
"hiddenPassword",
|
|
69
|
+
"handleDrop",
|
|
70
|
+
"handleDragStart"
|
|
67
71
|
];
|
|
68
72
|
const initState = ({ reactive, computed, mode, props, parent, constants }) => {
|
|
69
73
|
const state = reactive({
|
|
@@ -77,21 +81,29 @@ const initState = ({ reactive, computed, mode, props, parent, constants }) => {
|
|
|
77
81
|
checkedLable: "",
|
|
78
82
|
sheetvalue: props.modelValue,
|
|
79
83
|
inputSize: computed(() => props.size || state.formItemSize),
|
|
80
|
-
showClear: computed(
|
|
84
|
+
showClear: computed(
|
|
85
|
+
() => props.clearable && !state.inputDisabled && !props.readonly && state.nativeInputValue && (state.focused || state.hovering)
|
|
86
|
+
),
|
|
81
87
|
upperLimit: computed(() => parent.$attrs.maxlength),
|
|
82
88
|
textLength: computed(() => textLength(props.modelValue)),
|
|
83
89
|
inputExceed: computed(() => state.isWordLimitVisible && state.textLength > state.upperLimit),
|
|
84
90
|
formItemSize: computed(() => (parent.formItem || {}).formItemSize),
|
|
85
91
|
validateIcon: computed(() => constants.VALIDATE_ICON[state.validateState]),
|
|
86
92
|
showWordLimit: computed(() => props.showWordLimit && parent.$attrs.maxlength),
|
|
87
|
-
inputDisabled: computed(
|
|
93
|
+
inputDisabled: computed(
|
|
94
|
+
() => props.disabled || (parent.auiForm || {}).disabled || state.isDisplayOnly || (parent.tinyForm || {}).displayOnly
|
|
95
|
+
),
|
|
88
96
|
validateState: computed(() => parent.formItem ? parent.formItem.validateState : ""),
|
|
89
97
|
textareaStyle: computed(() => __spreadProps(__spreadValues({}, state.textareaCalcStyle), {
|
|
90
98
|
resize: props.resize
|
|
91
99
|
})),
|
|
92
100
|
needStatusIcon: computed(() => parent.tinyForm ? parent.tinyForm.statusIcon : false),
|
|
93
|
-
showPwdVisible: computed(
|
|
94
|
-
|
|
101
|
+
showPwdVisible: computed(
|
|
102
|
+
() => props.showPassword && !state.inputDisabled && !props.readonly && (!!state.nativeInputValue || state.focused)
|
|
103
|
+
),
|
|
104
|
+
nativeInputValue: computed(
|
|
105
|
+
() => props.modelValue === null || props.modelValue === void 0 ? "" : String(props.modelValue)
|
|
106
|
+
),
|
|
95
107
|
isWordLimitVisible: computed(
|
|
96
108
|
() => (props.showWordLimit && parent.$attrs.maxlength || props.counter) && (parent.type === "text" || parent.type === "textarea") && !state.inputDisabled && !props.readonly && !props.showPassword
|
|
97
109
|
),
|
|
@@ -119,7 +131,9 @@ const initApi = ({ api: api2, state, dispatch, broadcast, emit, refs, props, CLA
|
|
|
119
131
|
handleCompositionStart: handleCompositionStart(state),
|
|
120
132
|
handleCompositionUpdate: handleCompositionUpdate(state),
|
|
121
133
|
dispatchDisplayedValue: dispatchDisplayedValue({ state, props, dispatch, api: api2 }),
|
|
122
|
-
getDisplayedValue: getDisplayedValue({ state, props })
|
|
134
|
+
getDisplayedValue: getDisplayedValue({ state, props }),
|
|
135
|
+
handleDrop: handleDrop(emit),
|
|
136
|
+
handleDragStart: handleDragStart(emit)
|
|
123
137
|
});
|
|
124
138
|
};
|
|
125
139
|
const mergeApi = ({ storages, api: api2, componentName, props, emit, eventName, nextTick, parent, state, refs }) => {
|
|
@@ -148,7 +162,8 @@ const mergeApi = ({ storages, api: api2, componentName, props, emit, eventName,
|
|
|
148
162
|
calcTextareaHeight: calcTextareaHeight({
|
|
149
163
|
api: api2,
|
|
150
164
|
hiddenTextarea: null,
|
|
151
|
-
props
|
|
165
|
+
props,
|
|
166
|
+
state
|
|
152
167
|
}),
|
|
153
168
|
setNativeInputValue: setNativeInputValue({ api: api2, state }),
|
|
154
169
|
handleCompositionEnd: handleCompositionEnd({ api: api2, state }),
|
|
@@ -193,6 +208,17 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, emit, componentNa
|
|
|
193
208
|
});
|
|
194
209
|
}
|
|
195
210
|
);
|
|
211
|
+
watch(
|
|
212
|
+
() => state.isDisplayOnly,
|
|
213
|
+
() => {
|
|
214
|
+
nextTick(() => {
|
|
215
|
+
api2.setNativeInputValue();
|
|
216
|
+
api2.resizeTextarea();
|
|
217
|
+
api2.updateIconOffset();
|
|
218
|
+
api2.dispatchDisplayedValue();
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
);
|
|
196
222
|
watch(
|
|
197
223
|
() => state.sheetvalue,
|
|
198
224
|
(value) => api2.watchFormSelect(value),
|
package/ip-address/index.js
CHANGED
|
@@ -115,7 +115,7 @@ const keyup = ({ api, props }) => ({ item, index, event }) => {
|
|
|
115
115
|
item.value = item.value.replace(/\D/g, "");
|
|
116
116
|
return false;
|
|
117
117
|
}
|
|
118
|
-
if ([KEY_CODE.Space, KEY_CODE.NumpadDecimal, KEY_CODE.NumpadComma].includes(keyCode) && value) {
|
|
118
|
+
if ([KEY_CODE.Tab, KEY_CODE.Space, KEY_CODE.NumpadDecimal, KEY_CODE.NumpadComma].includes(keyCode) && value) {
|
|
119
119
|
api.select({ index: nextIndex });
|
|
120
120
|
return false;
|
|
121
121
|
}
|
|
@@ -126,14 +126,14 @@ const keyup = ({ api, props }) => ({ item, index, event }) => {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
const checkError1 = ({ Space, NumpadDecimal, NumpadComma, keyCode, value }) => [Space, NumpadDecimal, NumpadComma].includes(keyCode) && value;
|
|
129
|
+
const checkError1 = ({ Tab, Space, NumpadDecimal, NumpadComma, keyCode, value }) => [Tab, Space, NumpadDecimal, NumpadComma].includes(keyCode) && value;
|
|
130
130
|
const checkError2 = (newValue) => newValue && (isNaN(newValue) || newValue > IPTHRESHOLD.Max);
|
|
131
131
|
const checkError3 = ({ isfilterKeyCodes, isSelected, value }) => !isfilterKeyCodes && !isSelected && value === "0";
|
|
132
132
|
const checkError4 = ({ isfilterKeyCodes, isSelected, value, key }) => !isfilterKeyCodes && !isSelected && value + key > IPTHRESHOLD.Max;
|
|
133
133
|
const checkError5 = ({ key, isfilterKeyCodes, value, ctrlKey, keyCode, KeyV }) => isNaN(key) && !isfilterKeyCodes && !(!value && ctrlKey && keyCode === KeyV);
|
|
134
134
|
const isError = ({ key, value, isSelected, isfilterKeyCodes, ctrlKey, keyCode, newValue }) => {
|
|
135
|
-
const { Space, NumpadDecimal, NumpadComma, KeyV } = KEY_CODE;
|
|
136
|
-
return checkError1({ Space, NumpadDecimal, NumpadComma, keyCode, value }) || checkError2(newValue) || checkError3({ isfilterKeyCodes, isSelected, value }) || checkError4({ isfilterKeyCodes, isSelected, value, key }) || checkError5({ key, isfilterKeyCodes, value, ctrlKey, keyCode, KeyV });
|
|
135
|
+
const { Tab, Space, NumpadDecimal, NumpadComma, KeyV } = KEY_CODE;
|
|
136
|
+
return checkError1({ Tab, Space, NumpadDecimal, NumpadComma, keyCode, value }) || checkError2(newValue) || checkError3({ isfilterKeyCodes, isSelected, value }) || checkError4({ isfilterKeyCodes, isSelected, value, key }) || checkError5({ key, isfilterKeyCodes, value, ctrlKey, keyCode, KeyV });
|
|
137
137
|
};
|
|
138
138
|
const keydown = ({ api, props, state }) => ({ item, index, event }) => {
|
|
139
139
|
const { target, key, keyCode, ctrlKey } = event;
|
package/month-table/index.js
CHANGED
|
@@ -58,8 +58,11 @@ const getRows = ({ props, state, vm }) => () => {
|
|
|
58
58
|
return tableRows;
|
|
59
59
|
};
|
|
60
60
|
const markRange = ({ props, state }) => (minDate, maxDate) => {
|
|
61
|
-
minDate =
|
|
62
|
-
maxDate =
|
|
61
|
+
minDate = getMonthTimestamp(minDate);
|
|
62
|
+
maxDate = getMonthTimestamp(maxDate);
|
|
63
|
+
if (minDate > maxDate) {
|
|
64
|
+
[minDate, maxDate] = [maxDate, minDate];
|
|
65
|
+
}
|
|
63
66
|
const rows = state.rows;
|
|
64
67
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
65
68
|
const row = rows[i];
|
package/numeric/index.js
CHANGED
|
@@ -58,7 +58,7 @@ const increase = ({ api, props, state }) => () => {
|
|
|
58
58
|
if (state.inputDisabled || state.maxDisabled) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
const value = props.modelValue || 0;
|
|
61
|
+
const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0;
|
|
62
62
|
let newVal = api.internalIncrease({ val: value, step: props.step });
|
|
63
63
|
if (!props.circulate || !isFinite(props.max) || !isFinite(props.min)) {
|
|
64
64
|
api.setCurrentValue(newVal);
|
|
@@ -73,7 +73,7 @@ const decrease = ({ api, props, state }) => () => {
|
|
|
73
73
|
if (state.inputDisabled || state.minDisabled) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
const value = props.modelValue || 0;
|
|
76
|
+
const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0;
|
|
77
77
|
let newVal = api.internalDecrease({ val: value, step: props.step });
|
|
78
78
|
if (!props.circulate || !isFinite(props.max) || !isFinite(props.min)) {
|
|
79
79
|
api.setCurrentValue(newVal);
|
|
@@ -92,7 +92,10 @@ const handleBlur = ({ constants, dispatch, emit, props, state, api }) => (event)
|
|
|
92
92
|
dispatch(constants.COMPONENT_NAME, constants.EVENT_NAME.blur, [state.displayValue]);
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
-
const handleFocus = ({ emit, state, props, api }) => (event) => {
|
|
95
|
+
const handleFocus = ({ emit, state, props, api, refs }) => (event) => {
|
|
96
|
+
if (props.disabled) {
|
|
97
|
+
refs.input.blur();
|
|
98
|
+
}
|
|
96
99
|
state.inputStatus = true;
|
|
97
100
|
const currentValue = api.getDecimal(state.currentValue);
|
|
98
101
|
if (!currentValue.isNaN() && !isNull(state.currentValue)) {
|
package/numeric/vue.js
CHANGED
|
@@ -26,7 +26,18 @@ import {
|
|
|
26
26
|
dispatchDisplayedValue,
|
|
27
27
|
getDisplayedValue
|
|
28
28
|
} from "./index";
|
|
29
|
-
const api = [
|
|
29
|
+
const api = [
|
|
30
|
+
"state",
|
|
31
|
+
"decrease",
|
|
32
|
+
"increase",
|
|
33
|
+
"handleBlur",
|
|
34
|
+
"handleFocus",
|
|
35
|
+
"handleInput",
|
|
36
|
+
"handleInputChange",
|
|
37
|
+
"mouseEvent",
|
|
38
|
+
"focus",
|
|
39
|
+
"select"
|
|
40
|
+
];
|
|
30
41
|
const initState = ({ reactive, computed, props, api: api2, $service, parent }) => {
|
|
31
42
|
const state = reactive({
|
|
32
43
|
currentValue: props.modelValue,
|
|
@@ -41,8 +52,8 @@ const initState = ({ reactive, computed, props, api: api2, $service, parent }) =
|
|
|
41
52
|
inputDisabled: computed(() => props.disabled || state.formDisabled),
|
|
42
53
|
displayValue: computed(() => api2.displayValue()),
|
|
43
54
|
numPrecision: computed(() => api2.getNumPecision()),
|
|
44
|
-
minDisabled: computed(() => !props.circulate &&
|
|
45
|
-
maxDisabled: computed(() => !props.circulate &&
|
|
55
|
+
minDisabled: computed(() => !props.circulate && state.currentValue <= props.min || state.formDisabled),
|
|
56
|
+
maxDisabled: computed(() => !props.circulate && state.currentValue >= props.max || state.formDisabled),
|
|
46
57
|
controlsAtRight: computed(() => props.controls && props.controlsPosition === "right"),
|
|
47
58
|
format: computed(() => getUnitPrecision({ service: $service, props })),
|
|
48
59
|
isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly)
|
|
@@ -60,7 +71,7 @@ const initApi = ({ api: api2, props, state, parent, refs, emit, dispatch, consta
|
|
|
60
71
|
mounted: mounted({ constants, parent, props, refs, state }),
|
|
61
72
|
unmounted: unmounted({ parent, state }),
|
|
62
73
|
getDecimal: getDecimal(props),
|
|
63
|
-
handleFocus: handleFocus({ emit, state, props, api: api2 }),
|
|
74
|
+
handleFocus: handleFocus({ emit, state, props, api: api2, refs }),
|
|
64
75
|
decrease: decrease({ api: api2, props, state }),
|
|
65
76
|
increase: increase({ api: api2, props, state }),
|
|
66
77
|
handleInput: handleInput({ state, api: api2, emit, props }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/vue-renderless",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
|
|
5
5
|
"homepage": "https://opentiny.design/tiny-vue",
|
|
6
6
|
"keywords": [
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
],
|
|
17
17
|
"author": "OpenTiny Team",
|
|
18
18
|
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git@github.com:opentiny/tiny-vue.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/opentiny/tiny-vue/issues"
|
|
25
|
+
},
|
|
19
26
|
"sideEffects": false,
|
|
20
27
|
"scripts": {
|
|
21
28
|
"build": "tsup",
|
package/popconfirm/index.js
CHANGED
package/popconfirm/vue.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import { show, hide, confirm } from "./index";
|
|
3
3
|
const api = ["state", "show", "hide", "confirm"];
|
|
4
|
-
const renderless = (props, { computed, reactive }, { emit, constants }) => {
|
|
4
|
+
const renderless = (props, { computed, reactive }, { emit, constants, designConfig }) => {
|
|
5
|
+
var _a;
|
|
5
6
|
const api2 = {};
|
|
7
|
+
const designIcon = (_a = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _a[props.type];
|
|
6
8
|
const state = reactive({
|
|
7
9
|
isLock: false,
|
|
8
10
|
showPopover: false,
|
|
9
|
-
getIcon: computed(() => typeof props.type === "object" ? props.type : constants.ICON_MAP[props.type])
|
|
11
|
+
getIcon: computed(() => typeof props.type === "object" ? props.type : designIcon || constants.ICON_MAP[props.type])
|
|
10
12
|
});
|
|
11
13
|
Object.assign(api2, {
|
|
12
14
|
state,
|
package/popover/index.js
CHANGED
|
@@ -26,11 +26,13 @@ const processTrigger = ({ api, state, props, nextTick }) => {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
const mounted = ({ api, state, constants, props, nextTick }) => () => {
|
|
29
|
+
const mounted = ({ api, state, constants, props, nextTick, mode }) => () => {
|
|
30
30
|
state.mounted = true;
|
|
31
31
|
const { referenceElm, popperElm, tooltipId } = state;
|
|
32
32
|
if (referenceElm) {
|
|
33
|
-
|
|
33
|
+
if (mode !== "mobile-first") {
|
|
34
|
+
addClass(referenceElm, `${constants.IDPREFIX}__reference`);
|
|
35
|
+
}
|
|
34
36
|
referenceElm.setAttribute("aria-describedby", tooltipId);
|
|
35
37
|
referenceElm.setAttribute("tabindex", props.tabindex);
|
|
36
38
|
popperElm.setAttribute("tabindex", 0);
|
|
@@ -133,17 +135,22 @@ const cleanup = ({ props, state }) => () => {
|
|
|
133
135
|
}
|
|
134
136
|
};
|
|
135
137
|
const destroyed = ({ state, api }) => () => {
|
|
136
|
-
const
|
|
137
|
-
off(
|
|
138
|
-
off(
|
|
139
|
-
off(
|
|
140
|
-
off(
|
|
141
|
-
off(
|
|
142
|
-
off(
|
|
143
|
-
off(
|
|
144
|
-
off(reference, "mouseleave", api.handleMouseLeave);
|
|
145
|
-
off(reference, "mouseenter", api.handleMouseEnter);
|
|
138
|
+
const { referenceElm, popperElm } = state;
|
|
139
|
+
off(referenceElm, "click", api.doToggle);
|
|
140
|
+
off(referenceElm, "mouseup", api.doClose);
|
|
141
|
+
off(referenceElm, "mousedown", api.doShow);
|
|
142
|
+
off(referenceElm, "focusin", api.doShow);
|
|
143
|
+
off(referenceElm, "focusout", api.doClose);
|
|
144
|
+
off(referenceElm, "mouseleave", api.handleMouseLeave);
|
|
145
|
+
off(referenceElm, "mouseenter", api.handleMouseEnter);
|
|
146
146
|
off(document, "click", api.handleDocumentClick);
|
|
147
|
+
off(popperElm, "focusin", api.handleFocus);
|
|
148
|
+
off(popperElm, "focusout", api.handleBlur);
|
|
149
|
+
off(popperElm, "mouseenter", api.handleMouseEnter);
|
|
150
|
+
off(popperElm, "mouseleave", api.handleMouseLeave);
|
|
151
|
+
off(referenceElm, "click", api.handleClick);
|
|
152
|
+
off(referenceElm, "focusout", api.handleBlur);
|
|
153
|
+
off(referenceElm, "keydown", api.handleKeydown);
|
|
147
154
|
};
|
|
148
155
|
const computedTooltipId = (constants) => () => `${constants.IDPREFIX}-${guid("", 4)}`;
|
|
149
156
|
const wrapMounted = ({ api, props, refs, state }) => () => {
|
package/popover/vue.js
CHANGED
|
@@ -21,7 +21,16 @@ import {
|
|
|
21
21
|
observeCallback
|
|
22
22
|
} from "./index";
|
|
23
23
|
import userPopper from "../common/deps/vue-popper";
|
|
24
|
-
const api = [
|
|
24
|
+
const api = [
|
|
25
|
+
"state",
|
|
26
|
+
"handleAfterEnter",
|
|
27
|
+
"handleAfterLeave",
|
|
28
|
+
"doToggle",
|
|
29
|
+
"doShow",
|
|
30
|
+
"doClose",
|
|
31
|
+
"doDestroy",
|
|
32
|
+
"handleItemClick"
|
|
33
|
+
];
|
|
25
34
|
const initState = ({ reactive, computed, api: api2, popperElm, showPopper, referenceElm }) => {
|
|
26
35
|
const state = reactive({
|
|
27
36
|
popperElm,
|
|
@@ -29,14 +38,15 @@ const initState = ({ reactive, computed, api: api2, popperElm, showPopper, refer
|
|
|
29
38
|
timer: null,
|
|
30
39
|
mounted: false,
|
|
31
40
|
referenceElm,
|
|
41
|
+
xPlacement: "bottom",
|
|
32
42
|
tooltipId: computed(() => api2.computedTooltipId())
|
|
33
43
|
});
|
|
34
44
|
return state;
|
|
35
45
|
};
|
|
36
|
-
const initApi = ({ api: api2, props, state, refs, emit, doDestroy, constants, nextTick, vm }) => {
|
|
46
|
+
const initApi = ({ api: api2, props, state, refs, emit, doDestroy, constants, nextTick, vm, mode }) => {
|
|
37
47
|
Object.assign(api2, {
|
|
38
48
|
state,
|
|
39
|
-
mounted: mounted({ api: api2, state, constants, props, nextTick }),
|
|
49
|
+
mounted: mounted({ api: api2, state, constants, props, nextTick, mode }),
|
|
40
50
|
cleanup: cleanup({ state, props }),
|
|
41
51
|
destroyed: destroyed({ state, api: api2 }),
|
|
42
52
|
doDestroy,
|
|
@@ -81,13 +91,13 @@ const initWatch = ({ watch, props, state, emit, api: api2, nextTick }) => {
|
|
|
81
91
|
}
|
|
82
92
|
);
|
|
83
93
|
};
|
|
84
|
-
const renderless = (props, { reactive, computed, watch, toRefs, onBeforeUnmount, onMounted, onUnmounted, onActivated, onDeactivated }, { $prefix, emit, vm, refs, slots, nextTick }) => {
|
|
94
|
+
const renderless = (props, { reactive, computed, watch, toRefs, onBeforeUnmount, onMounted, onUnmounted, onActivated, onDeactivated }, { $prefix, emit, vm, refs, slots, nextTick, mode }) => {
|
|
85
95
|
const api2 = {};
|
|
86
96
|
const constants = { IDPREFIX: `${$prefix.toLowerCase()}-popover` };
|
|
87
97
|
const options = { emit, onBeforeUnmount, nextTick, reactive, props, watch, onDeactivated, refs, slots, toRefs };
|
|
88
98
|
const { showPopper, popperElm, referenceElm, doDestroy } = userPopper(options);
|
|
89
99
|
const state = initState({ reactive, computed, api: api2, popperElm, showPopper, referenceElm });
|
|
90
|
-
initApi({ api: api2, constants, props, state, refs, emit, doDestroy, nextTick, vm });
|
|
100
|
+
initApi({ api: api2, constants, props, state, refs, emit, doDestroy, nextTick, vm, mode });
|
|
91
101
|
onDeactivated(() => {
|
|
92
102
|
api2.destroyed();
|
|
93
103
|
api2.cleanup();
|
package/progress/index.js
CHANGED
|
@@ -3,7 +3,11 @@ const computedBarStyle = ({ api, props }) => () => ({
|
|
|
3
3
|
width: props.percentage + "%",
|
|
4
4
|
backgroundColor: api.getCurrentColor(props.percentage)
|
|
5
5
|
});
|
|
6
|
-
const computedRelativeStrokeWidth = ({
|
|
6
|
+
const computedRelativeStrokeWidth = ({ constants, state }) => () => {
|
|
7
|
+
if (state.width === 0 || state.strokeWidth === 0)
|
|
8
|
+
return constants.REL_STROKE_WIDTH;
|
|
9
|
+
return (state.strokeWidth / state.width * 100).toFixed(1);
|
|
10
|
+
};
|
|
7
11
|
const computedRadius = ({ constants, props, state }) => () => props.type === constants.PROGRESS_TYPE.CIRCLE || props.type === constants.PROGRESS_TYPE.DASHBOARD ? parseInt(50 - parseFloat(state.relativeStrokeWidth) / 2, 10) : 0;
|
|
8
12
|
const computedTrackPath = ({ constants, props, state }) => () => {
|
|
9
13
|
const radiusValue = state.radius;
|
|
@@ -22,23 +26,55 @@ const computedTrailPathStyle = ({ state }) => () => ({
|
|
|
22
26
|
strokeDasharray: `${state.perimeter * state.rate}px, ${state.perimeter}px`,
|
|
23
27
|
strokeDashoffset: state.strokeDashoffset
|
|
24
28
|
});
|
|
29
|
+
const computedCircleStyle = ({ state }) => () => state.width ? { height: state.width + "px", width: state.width + "px" } : {};
|
|
25
30
|
const computedCirclePathStyle = ({ props, state }) => () => ({
|
|
26
31
|
strokeDasharray: `${state.perimeter * state.rate * (props.percentage / 100)}px, ${state.perimeter}px`,
|
|
27
32
|
strokeDashoffset: state.strokeDashoffset,
|
|
28
33
|
transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"
|
|
29
34
|
});
|
|
30
35
|
const computedStroke = ({ api, constants, props }) => () => props.color && api.getCurrentColor(props.percentage) || constants.STATUS_TO_COLOR[props.status] || constants.STATUS_DEFAULT_COLOR;
|
|
31
|
-
const computedIconClass = ({ constants, props }) => () => {
|
|
36
|
+
const computedIconClass = ({ constants, props, mode }) => () => {
|
|
32
37
|
if (props.status === constants.PROGRESS_STATUS.SUCCESS) {
|
|
33
|
-
|
|
38
|
+
const iconClasses = props.type === constants.PROGRESS_TYPE.LINE ? [constants.ICON_SUCCESS, constants.ICON_CIRCLE_SUCCESS] : [constants.ICON_CIRCLE_SUCCESS, constants.ICON_SUCCESS];
|
|
39
|
+
return mode === "mobile-first" ? iconClasses[1] : iconClasses[0];
|
|
34
40
|
} else if (props.status === constants.PROGRESS_STATUS.WARNING) {
|
|
35
41
|
return props.type === constants.PROGRESS_TYPE.LINE ? constants.ICON_WARNING : constants.ICON_CIRCLE_WARNING;
|
|
36
42
|
} else if (props.status === constants.PROGRESS_STATUS.EXCEPTION) {
|
|
37
|
-
|
|
43
|
+
const iconClasses = props.type === constants.PROGRESS_TYPE.LINE ? [constants.ICON_EXCEPTION, constants.ICON_CIRCLE_EXCEPTION] : [constants.ICON_CIRCLE_EXCEPTION, constants.ICON_EXCEPTION];
|
|
44
|
+
return mode === "mobile-first" ? iconClasses[1] : iconClasses[0];
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const computedIconStyle = ({ constants, props, state }) => () => {
|
|
48
|
+
if (props.type === constants.PROGRESS_TYPE.LINE) {
|
|
49
|
+
return state.strokeWidth ? {
|
|
50
|
+
width: constants.TEXT_XS + state.strokeWidth * constants.STROKE_WIDTH_RATE,
|
|
51
|
+
height: constants.TEXT_XS + state.strokeWidth * constants.STROKE_WIDTH_RATE
|
|
52
|
+
} : {};
|
|
53
|
+
} else {
|
|
54
|
+
return state.width ? { width: state.width / constants.WIDTH_RATE_TWO, height: state.width / constants.WIDTH_RATE_TWO } : {};
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const computedProgressTextSize = ({ constants, props, state, mode }) => () => {
|
|
58
|
+
if (mode === "mobile-first") {
|
|
59
|
+
let fontSize = constants.TEXT_XS;
|
|
60
|
+
const sizeWidthMap = {
|
|
61
|
+
small: constants.PROGRESS_SIZE_WIDTH.SMALL,
|
|
62
|
+
medium: constants.PROGRESS_SIZE_WIDTH.MEDIUM,
|
|
63
|
+
large: constants.PROGRESS_SIZE_WIDTH.LARGE
|
|
64
|
+
};
|
|
65
|
+
if (props.type === constants.PROGRESS_TYPE.LINE) {
|
|
66
|
+
fontSize = state.strokeWidth ? constants.TEXT_XS + state.strokeWidth * constants.STROKE_WIDTH_RATE : props.size === constants.PROGRESS_SIZE.SMALL ? constants.TEXT_XS : constants.TEXT_SM;
|
|
67
|
+
} else {
|
|
68
|
+
const width = state.width ? state.width : sizeWidthMap[props.size];
|
|
69
|
+
fontSize = width / constants.WIDTH_RATE_THREE;
|
|
70
|
+
state.percentTextSize = width / constants.WIDTH_RATE_SIX;
|
|
71
|
+
}
|
|
72
|
+
return fontSize;
|
|
73
|
+
} else {
|
|
74
|
+
return props.type === constants.PROGRESS_TYPE.LINE ? constants.TEXT_XS + state.strokeWidth * constants.STROKE_WIDTH_RATE : state.width * 0.111111 + 2;
|
|
38
75
|
}
|
|
39
76
|
};
|
|
40
|
-
const
|
|
41
|
-
const computedContent = ({ props }) => () => typeof props.format === "function" ? props.format(props.percentage) || "" : `${props.percentage}%`;
|
|
77
|
+
const computedContent = ({ props }) => () => typeof props.format === "function" ? props.format() || "" : `${props.percentage}%`;
|
|
42
78
|
const getCurrentColor = ({ api, props }) => (percentage) => {
|
|
43
79
|
if (typeof props.color === "function") {
|
|
44
80
|
return props.color(percentage);
|
|
@@ -91,8 +127,10 @@ const customAfterAppearHook = ({ state, props }) => (el) => {
|
|
|
91
127
|
export {
|
|
92
128
|
computedBarStyle,
|
|
93
129
|
computedCirclePathStyle,
|
|
130
|
+
computedCircleStyle,
|
|
94
131
|
computedContent,
|
|
95
132
|
computedIconClass,
|
|
133
|
+
computedIconStyle,
|
|
96
134
|
computedPerimeter,
|
|
97
135
|
computedProgressTextSize,
|
|
98
136
|
computedRadius,
|
package/progress/vue.js
CHANGED
|
@@ -8,9 +8,11 @@ import {
|
|
|
8
8
|
computedRate,
|
|
9
9
|
computedStrokeDashoffset,
|
|
10
10
|
computedTrailPathStyle,
|
|
11
|
+
computedCircleStyle,
|
|
11
12
|
computedCirclePathStyle,
|
|
12
13
|
computedStroke,
|
|
13
14
|
computedIconClass,
|
|
15
|
+
computedIconStyle,
|
|
14
16
|
computedProgressTextSize,
|
|
15
17
|
computedContent,
|
|
16
18
|
getCurrentColor,
|
|
@@ -21,9 +23,10 @@ import {
|
|
|
21
23
|
customAfterAppearHook
|
|
22
24
|
} from "./index";
|
|
23
25
|
const api = ["state", "getCurrentColor", "getLevelColor", "getColorArray", "customBeforeAppearHook", "customAppearHook", "customAfterAppearHook"];
|
|
24
|
-
const renderless = (props, { computed, reactive }, { constants }) => {
|
|
26
|
+
const renderless = (props, { computed, reactive }, { constants, mode }) => {
|
|
25
27
|
const api2 = {};
|
|
26
28
|
const state = reactive({
|
|
29
|
+
percentTextSize: constants.TEXT_XS,
|
|
27
30
|
rate: computed(() => api2.computedRate()),
|
|
28
31
|
radius: computed(() => api2.computedRadius()),
|
|
29
32
|
stroke: computed(() => api2.computedStroke()),
|
|
@@ -32,10 +35,16 @@ const renderless = (props, { computed, reactive }, { constants }) => {
|
|
|
32
35
|
trackPath: computed(() => api2.computedTrackPath()),
|
|
33
36
|
perimeter: computed(() => api2.computedPerimeter()),
|
|
34
37
|
iconClass: computed(() => api2.computedIconClass()),
|
|
38
|
+
iconStyle: computed(() => api2.computedIconStyle()),
|
|
39
|
+
circleStyle: computed(() => api2.computedCircleStyle()),
|
|
35
40
|
trailPathStyle: computed(() => api2.computedTrailPathStyle()),
|
|
36
41
|
circlePathStyle: computed(() => api2.computedCirclePathStyle()),
|
|
37
42
|
progressTextSize: computed(() => api2.computedProgressTextSize()),
|
|
38
43
|
strokeDashoffset: computed(() => api2.computedStrokeDashoffset()),
|
|
44
|
+
strokeWidth: computed(
|
|
45
|
+
() => mode === "mobile-first" ? props.strokeWidth : props.strokeWidth || constants.DEFAULT_STROKE_WIDTH
|
|
46
|
+
),
|
|
47
|
+
width: computed(() => mode === "mobile-first" ? props.width : props.width || constants.DEFAULT_WIDTH),
|
|
39
48
|
relativeStrokeWidth: computed(() => api2.computedRelativeStrokeWidth())
|
|
40
49
|
});
|
|
41
50
|
Object.assign(api2, {
|
|
@@ -47,12 +56,14 @@ const renderless = (props, { computed, reactive }, { constants }) => {
|
|
|
47
56
|
computedPerimeter: computedPerimeter({ state }),
|
|
48
57
|
computedRadius: computedRadius({ constants, props, state }),
|
|
49
58
|
computedTrackPath: computedTrackPath({ constants, props, state }),
|
|
50
|
-
computedIconClass: computedIconClass({ constants, props }),
|
|
59
|
+
computedIconClass: computedIconClass({ constants, props, mode }),
|
|
60
|
+
computedIconStyle: computedIconStyle({ constants, props, state }),
|
|
61
|
+
computedCircleStyle: computedCircleStyle({ props, state }),
|
|
51
62
|
computedCirclePathStyle: computedCirclePathStyle({ props, state }),
|
|
52
63
|
computedStrokeDashoffset: computedStrokeDashoffset({ state }),
|
|
53
64
|
computedTrailPathStyle: computedTrailPathStyle({ state }),
|
|
54
|
-
computedRelativeStrokeWidth: computedRelativeStrokeWidth({
|
|
55
|
-
computedProgressTextSize: computedProgressTextSize({ constants, props }),
|
|
65
|
+
computedRelativeStrokeWidth: computedRelativeStrokeWidth({ state, constants }),
|
|
66
|
+
computedProgressTextSize: computedProgressTextSize({ state, constants, props, mode }),
|
|
56
67
|
customAfterAppearHook: customAfterAppearHook({ state, props }),
|
|
57
68
|
customBeforeAppearHook: customBeforeAppearHook({ props, state }),
|
|
58
69
|
getLevelColor: getLevelColor(api2),
|
package/radio/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const isGroup = ({ constants, parent: $parent, state }) => () => {
|
|
|
19
19
|
};
|
|
20
20
|
const radioSize = ({ props, state }) => () => state.isGroup ? state.radioGroup.state.radioGroupSize || props.size : props.size;
|
|
21
21
|
const isDisabled = ({ props, state }) => () => props.disabled || state.radioGroup.disabled || state.formDisabled;
|
|
22
|
+
const isDisplayOnly = ({ props }) => () => props.displayOnly;
|
|
22
23
|
const tabIndex = ({ props, state }) => () => state.isDisabled || state.isGroup && state.model !== props.label ? -1 : 0;
|
|
23
24
|
const getModel = ({ props, state }) => () => state.isGroup ? state.radioGroup.modelValue : props.modelValue;
|
|
24
25
|
const setModel = ({ constants, dispatch, emit, props, refs, state }) => (val) => {
|
|
@@ -56,6 +57,7 @@ export {
|
|
|
56
57
|
getModel,
|
|
57
58
|
handleChange,
|
|
58
59
|
isDisabled,
|
|
60
|
+
isDisplayOnly,
|
|
59
61
|
isGroup,
|
|
60
62
|
radioSize,
|
|
61
63
|
setModel,
|
package/radio/vue.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
isGroup,
|
|
5
5
|
radioSize,
|
|
6
6
|
isDisabled,
|
|
7
|
+
isDisplayOnly,
|
|
7
8
|
tabIndex,
|
|
8
9
|
getModel,
|
|
9
10
|
setModel,
|
|
@@ -21,6 +22,7 @@ const renderless = (props, { onMounted, onBeforeUnmount, computed, reactive, inj
|
|
|
21
22
|
isGroup: computed(() => api2.isGroup()),
|
|
22
23
|
radioSize: computed(() => api2.radioSize()),
|
|
23
24
|
isDisabled: computed(() => api2.isDisabled()),
|
|
25
|
+
isDisplayOnly: computed(() => api2.isDisplayOnly() || (parent.auiForm || {}).displayOnly),
|
|
24
26
|
tabIndex: computed(() => api2.tabIndex()),
|
|
25
27
|
formDisabled: computed(() => (parent.tinyForm || {}).disabled),
|
|
26
28
|
model: computed({
|
|
@@ -35,6 +37,7 @@ const renderless = (props, { onMounted, onBeforeUnmount, computed, reactive, inj
|
|
|
35
37
|
isGroup: isGroup({ constants, parent, state }),
|
|
36
38
|
tabIndex: tabIndex({ props, state }),
|
|
37
39
|
isDisabled: isDisabled({ props, state }),
|
|
40
|
+
isDisplayOnly: isDisplayOnly({ props }),
|
|
38
41
|
setModel: setModel({ constants, dispatch, emit, props, refs, state }),
|
|
39
42
|
handleChange: handleChange({ constants, dispatch, emit, state, nextTick }),
|
|
40
43
|
dispatchDisplayedValue: dispatchDisplayedValue({ state, api: api2, dispatch }),
|