@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/chart-heatmap/index.js
CHANGED
|
@@ -92,26 +92,26 @@ const fixParam = ({ type, rows, dimension, metrics, extraMetrics, chartData, inn
|
|
|
92
92
|
return { chartData, innerXAxisList, innerYAxisList };
|
|
93
93
|
};
|
|
94
94
|
const getResult = (args) => {
|
|
95
|
-
let { type, options, pointSize, blurSize, res, key, v, bmap, mapOrigin, geo, beforeRegisterMap } = args;
|
|
95
|
+
let { type, options, pointSize, blurSize, res, key, v, url, bmap, mapOrigin, geo, beforeRegisterMap } = args;
|
|
96
96
|
let { echarts, specialAreas, position, positionJsonLink, beforeRegisterMapOnce } = args;
|
|
97
97
|
let { mapURLProfix, amap, tooltip, xAxis, yAxis } = args;
|
|
98
98
|
if (type === "bmap") {
|
|
99
99
|
Object.assign(options.series[0], { coordinateSystem: "bmap", pointSize, blurSize });
|
|
100
|
-
res = getBmap(key, v).then(() => __spreadValues({ bmap }, options));
|
|
100
|
+
res = getBmap({ key, version: v, url }).then(() => __spreadValues({ bmap }, options));
|
|
101
101
|
} else if (type === "map") {
|
|
102
102
|
options.series[0].coordinateSystem = "geo";
|
|
103
|
-
let
|
|
104
|
-
if (
|
|
105
|
-
const geoAttr = __spreadValues({ map:
|
|
106
|
-
beforeRegisterMap && (
|
|
107
|
-
echarts.registerMap(
|
|
103
|
+
let jsonStr = JSON.stringify(mapOrigin);
|
|
104
|
+
if (jsonStr) {
|
|
105
|
+
const geoAttr = __spreadValues({ map: jsonStr }, geo);
|
|
106
|
+
beforeRegisterMap && (jsonStr = beforeRegisterMap(mapOrigin));
|
|
107
|
+
echarts.registerMap(jsonStr, { geoJSON: mapOrigin }, specialAreas);
|
|
108
108
|
res = new Promise((resolve) => resolve(__spreadValues({ geo: geoAttr }, options)));
|
|
109
109
|
} else {
|
|
110
110
|
let params = { position, positionJsonLink, beforeRegisterMapOnce, mapURLProfix };
|
|
111
|
-
res = getMapJSON(params).then((
|
|
111
|
+
res = getMapJSON(params).then((json) => {
|
|
112
112
|
const geoAttr = __spreadValues({ map: position }, geo);
|
|
113
|
-
beforeRegisterMap && (
|
|
114
|
-
echarts.registerMap(position,
|
|
113
|
+
beforeRegisterMap && (json = beforeRegisterMap(json));
|
|
114
|
+
echarts.registerMap(position, { geoJSON: json }, specialAreas);
|
|
115
115
|
return __spreadValues({ geo: geoAttr }, options);
|
|
116
116
|
});
|
|
117
117
|
}
|
|
@@ -126,7 +126,7 @@ const getResult = (args) => {
|
|
|
126
126
|
const heatmap = (columns, rows, settings, extra) => {
|
|
127
127
|
const { type = "cartesian" } = settings;
|
|
128
128
|
const { dimension = [columns[0], columns[1]] } = settings;
|
|
129
|
-
const { dataType = "normal", min, max, digit, bmap, amap, geo, key, v = "2.0" } = settings;
|
|
129
|
+
const { dataType = "normal", min, max, digit, bmap, amap, geo, key, v = "2.0", url } = settings;
|
|
130
130
|
const { position, mapOrigin, positionJsonLink, beforeRegisterMap, pointSize = 10, blurSize = 5 } = settings;
|
|
131
131
|
const { heatColor, yAxisName, xAxisName, beforeRegisterMapOnce, specialAreas = {} } = settings;
|
|
132
132
|
const { metrics = columns[2], mapURLProfix = "https://unpkg.com/echarts@3.6.2/map/json/" } = settings;
|
|
@@ -150,7 +150,7 @@ const heatmap = (columns, rows, settings, extra) => {
|
|
|
150
150
|
const tooltip = tooltipVisible && getTooltip(tooltipParams);
|
|
151
151
|
const options = { visualMap, series, grid: { left: 25, right: 80, width: "auto", height: "auto" } };
|
|
152
152
|
let res;
|
|
153
|
-
let args = { type, options, pointSize, blurSize, res, key, v, bmap, mapOrigin, geo, beforeRegisterMap };
|
|
153
|
+
let args = { type, options, pointSize, blurSize, res, key, v, url, bmap, mapOrigin, geo, beforeRegisterMap };
|
|
154
154
|
Object.assign(args, { echarts, specialAreas, position, positionJsonLink, beforeRegisterMapOnce });
|
|
155
155
|
Object.assign(args, { mapURLProfix, amap, tooltip, xAxis, yAxis });
|
|
156
156
|
res = getResult(args);
|
package/checkbox/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
+
import { isNull } from "../common/type";
|
|
2
3
|
const addToStore = ({ state, props }) => () => {
|
|
3
4
|
if (Array.isArray(state.model) && !state.model.includes(props.label)) {
|
|
4
5
|
state.model.push(props.label);
|
|
@@ -6,15 +7,24 @@ const addToStore = ({ state, props }) => () => {
|
|
|
6
7
|
state.model = props.trueLabel || true;
|
|
7
8
|
}
|
|
8
9
|
};
|
|
10
|
+
const removeFromStore = ({ state, props }) => () => {
|
|
11
|
+
if (Array.isArray(state.model)) {
|
|
12
|
+
const index = state.model.indexOf(props.label);
|
|
13
|
+
index !== -1 && state.model.splice(index, 1);
|
|
14
|
+
} else {
|
|
15
|
+
state.model = props.falseLabel !== void 0 && props.falseLabel;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
9
18
|
const handleChange = ({ state, props, emit, nextTick, dispatch, constants }) => (event) => {
|
|
10
19
|
if (state.isLimitExceeded) {
|
|
11
20
|
return;
|
|
12
21
|
}
|
|
13
22
|
let moduleValue;
|
|
23
|
+
const { trueLabel, falseLabel } = props;
|
|
14
24
|
if (event.target.checked) {
|
|
15
|
-
moduleValue =
|
|
25
|
+
moduleValue = trueLabel === void 0 ? true : trueLabel;
|
|
16
26
|
} else {
|
|
17
|
-
moduleValue =
|
|
27
|
+
moduleValue = falseLabel === void 0 ? false : falseLabel;
|
|
18
28
|
}
|
|
19
29
|
emit("change", moduleValue, event);
|
|
20
30
|
nextTick(() => {
|
|
@@ -23,7 +33,7 @@ const handleChange = ({ state, props, emit, nextTick, dispatch, constants }) =>
|
|
|
23
33
|
};
|
|
24
34
|
const computedGetModelGet = ({ state, props }) => () => {
|
|
25
35
|
const model = state.isGroup ? state.store : props.modelValue !== void 0 ? props.modelValue : state.selfModel;
|
|
26
|
-
return
|
|
36
|
+
return isNull(model) ? [] : model;
|
|
27
37
|
};
|
|
28
38
|
const computedGetModelSet = ({ state, dispatch, emit, constants }) => (value) => {
|
|
29
39
|
if (state.isGroup) {
|
|
@@ -41,7 +51,7 @@ const computedIsChecked = ({ state, props }) => () => {
|
|
|
41
51
|
return state.model;
|
|
42
52
|
} else if (Array.isArray(state.model)) {
|
|
43
53
|
return state.model.includes(props.label);
|
|
44
|
-
} else if (state.model
|
|
54
|
+
} else if (!isNull(state.model)) {
|
|
45
55
|
return state.model === props.trueLabel;
|
|
46
56
|
}
|
|
47
57
|
};
|
|
@@ -62,7 +72,7 @@ const computedIsLimitDisabled = (state) => () => {
|
|
|
62
72
|
const { max, min } = state.checkboxGroup;
|
|
63
73
|
return !!(max || min) && state.model.length >= max && !state.isChecked || state.model.length <= min && state.isChecked;
|
|
64
74
|
};
|
|
65
|
-
const computedIsDisabled = ({ state, props }) => () => (state.isGroup ? state.checkboxGroup.disabled || props.disabled || state.isLimitDisabled : props.disabled) || state.formDisabled;
|
|
75
|
+
const computedIsDisabled = ({ state, props }) => () => (state.isGroup ? state.checkboxGroup.disabled || state.checkboxGroup.displayOnly || props.disabled || props.displayOnly || state.isLimitDisabled : props.disabled) || state.formDisabled;
|
|
66
76
|
const computedFormItemSize = (props) => () => (props.formItem || {}).formItemSize;
|
|
67
77
|
const computedCheckboxSize = ({ state, props, formItemSize }) => () => {
|
|
68
78
|
const tempCheckboxSize = props.size || formItemSize.value;
|
|
@@ -75,7 +85,9 @@ const mounted = ({ props, emit, api, parent }) => () => {
|
|
|
75
85
|
};
|
|
76
86
|
const toggleEvent = ({ parent, props, type }) => {
|
|
77
87
|
const inputEl = parent.$el;
|
|
78
|
-
|
|
88
|
+
for (let ev in props.events) {
|
|
89
|
+
inputEl[type + "EventListener"](ev, props.events[ev]);
|
|
90
|
+
}
|
|
79
91
|
};
|
|
80
92
|
const dispatchDisplayedValue = ({ state, api, dispatch }) => () => {
|
|
81
93
|
if (state.isDisplayOnly) {
|
|
@@ -111,5 +123,6 @@ export {
|
|
|
111
123
|
getDisplayedValue,
|
|
112
124
|
handleChange,
|
|
113
125
|
mounted,
|
|
126
|
+
removeFromStore,
|
|
114
127
|
toggleEvent
|
|
115
128
|
};
|
package/checkbox/vue.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
__spreadProps,
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "../chunk-PKUHTIDK.js";
|
|
1
|
+
import "../chunk-PKUHTIDK.js";
|
|
5
2
|
import {
|
|
6
3
|
addToStore,
|
|
4
|
+
removeFromStore,
|
|
7
5
|
handleChange,
|
|
8
6
|
computedGetModelGet,
|
|
9
7
|
computedGetModelSet,
|
|
@@ -12,20 +10,23 @@ import {
|
|
|
12
10
|
computedStore,
|
|
13
11
|
computedIsLimitDisabled,
|
|
14
12
|
computedIsDisabled,
|
|
13
|
+
computedIsDisplayOnly,
|
|
14
|
+
computedIsGroupDisplayOnly,
|
|
15
15
|
computedFormItemSize,
|
|
16
16
|
computedCheckboxSize,
|
|
17
17
|
mounted,
|
|
18
18
|
toggleEvent,
|
|
19
19
|
dispatchDisplayedValue,
|
|
20
|
-
getDisplayedValue
|
|
21
|
-
computedIsDisplayOnly,
|
|
22
|
-
computedIsGroupDisplayOnly
|
|
20
|
+
getDisplayedValue
|
|
23
21
|
} from "./index";
|
|
24
|
-
const api = ["state", "handleChange"];
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const api = ["state", "handleChange", "computedStore"];
|
|
23
|
+
const initState = ({ reactive, computed, parent, api: api2, inject, props }) => {
|
|
24
|
+
const state = reactive({
|
|
25
|
+
size: props.size || inject("size", null),
|
|
26
|
+
vertical: inject("vertical", null),
|
|
27
|
+
focus: false,
|
|
28
|
+
selfModel: false,
|
|
29
|
+
isLimitExceeded: false,
|
|
29
30
|
store: computed(() => api2.computedStore()),
|
|
30
31
|
isGroup: computed(() => api2.computedIsGroup()),
|
|
31
32
|
isChecked: computed(() => api2.computedIsChecked()),
|
|
@@ -36,11 +37,18 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, wat
|
|
|
36
37
|
formDisplayOnly: computed(() => (parent.tinyForm || {}).displayOnly),
|
|
37
38
|
isDisplayOnly: computed(() => api2.computedIsDisplayOnly()),
|
|
38
39
|
isGroupDisplayOnly: computed(() => api2.computedIsGroupDisplayOnly()),
|
|
39
|
-
model: computed({
|
|
40
|
-
|
|
40
|
+
model: computed({
|
|
41
|
+
get: () => api2.computedGetModelGet(),
|
|
42
|
+
set: (value) => api2.computedGetModelSet(value)
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
return state;
|
|
46
|
+
};
|
|
47
|
+
const initApi = ({ vm, api: api2, state, dispatch, props, parent, constants, formItemSize, emit, nextTick }) => {
|
|
41
48
|
Object.assign(api2, {
|
|
42
49
|
state,
|
|
43
50
|
addToStore: addToStore({ state, props }),
|
|
51
|
+
removeFromStore: removeFromStore({ state, props }),
|
|
44
52
|
computedStore: computedStore({ state, props }),
|
|
45
53
|
computedFormItemSize: computedFormItemSize(props),
|
|
46
54
|
computedIsChecked: computedIsChecked({ state, props }),
|
|
@@ -50,21 +58,31 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, wat
|
|
|
50
58
|
computedIsGroupDisplayOnly: computedIsGroupDisplayOnly({ state }),
|
|
51
59
|
computedGetModelGet: computedGetModelGet({ state, props }),
|
|
52
60
|
computedIsGroup: computedIsGroup({ state, parent, constants }),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const formItemSize = computed(() => api2.computedFormItemSize());
|
|
56
|
-
api2.computedCheckboxSize = computedCheckboxSize({ state, props, formItemSize });
|
|
57
|
-
Object.assign(api2, {
|
|
61
|
+
computedCheckboxSize: computedCheckboxSize({ state, props, formItemSize }),
|
|
62
|
+
computedGetModelSet: computedGetModelSet({ state, dispatch, emit, constants }),
|
|
58
63
|
mounted: mounted({ emit, props, api: api2, parent }),
|
|
59
|
-
handleChange: handleChange({ state, props, emit, nextTick, dispatch
|
|
64
|
+
handleChange: handleChange({ state, props, emit, nextTick, dispatch, constants }),
|
|
60
65
|
dispatchDisplayedValue: dispatchDisplayedValue({ state, api: api2, dispatch }),
|
|
61
66
|
getDisplayedValue: getDisplayedValue({ state, props, vm })
|
|
62
67
|
});
|
|
68
|
+
};
|
|
69
|
+
const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject }, { vm, parent, emit, constants, nextTick, dispatch }) => {
|
|
70
|
+
const api2 = { dispatch };
|
|
71
|
+
const formItemSize = computed(() => api2.computedFormItemSize());
|
|
72
|
+
const state = initState({ reactive, computed, parent, api: api2, inject, props });
|
|
73
|
+
parent.tinyForm = parent.tinyForm || inject("form", null);
|
|
74
|
+
initApi({ vm, api: api2, state, dispatch, props, parent, constants, formItemSize, emit, nextTick });
|
|
63
75
|
watch(
|
|
64
76
|
() => props.modelValue,
|
|
65
77
|
(value) => props.validateEvent && api2.dispatch(constants.FORM_ITEM, constants.FORM_CHANGE, value)
|
|
66
78
|
);
|
|
67
79
|
watch(() => state.isDisplayOnly, api2.dispatchDisplayedValue);
|
|
80
|
+
watch(
|
|
81
|
+
() => props.checked,
|
|
82
|
+
(value) => {
|
|
83
|
+
value ? api2.addToStore() : api2.removeFromStore();
|
|
84
|
+
}
|
|
85
|
+
);
|
|
68
86
|
onBeforeUnmount(() => {
|
|
69
87
|
toggleEvent({ parent, props, type: "remove" });
|
|
70
88
|
});
|
package/common/bigInt.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import { fillChar } from "./string";
|
|
3
|
-
|
|
3
|
+
import { isBrowser } from "./browser";
|
|
4
|
+
const BigInt = isBrowser ? window.BigInt : global.BigInt;
|
|
4
5
|
function supportBigInt() {
|
|
5
6
|
return typeof BigInt === "function";
|
|
6
7
|
}
|
package/common/browser.js
CHANGED
|
@@ -22,52 +22,58 @@ const isEdge = (browser) => {
|
|
|
22
22
|
browser.edge = true;
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
+
const isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document;
|
|
25
26
|
var browser_default = (() => {
|
|
26
|
-
const isMobile = /(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent);
|
|
27
27
|
const browser = {
|
|
28
28
|
name: void 0,
|
|
29
29
|
version: void 0,
|
|
30
30
|
isDoc: typeof document !== "undefined",
|
|
31
|
-
isMobile,
|
|
32
|
-
isPC:
|
|
31
|
+
isMobile: false,
|
|
32
|
+
isPC: true,
|
|
33
33
|
isNode: typeof window === "undefined"
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
browser.
|
|
38
|
-
browser.
|
|
39
|
-
matches
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
browser
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
35
|
+
if (isBrowser) {
|
|
36
|
+
const isMobile = /(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent);
|
|
37
|
+
browser.isMobile = isMobile;
|
|
38
|
+
browser.isPC = !isMobile;
|
|
39
|
+
let matches;
|
|
40
|
+
if (!!window.chrome && (!!window.chrome.webstore || /^Google\b/.test(window.navigator.vendor))) {
|
|
41
|
+
browser.name = "chrome";
|
|
42
|
+
browser.chrome = true;
|
|
43
|
+
matches = navigator.userAgent.match(/chrome\/(\d+)/i);
|
|
44
|
+
browser.version = !!matches && !!matches[1] && parseInt(matches[1], 10);
|
|
45
|
+
matches = void 0;
|
|
46
|
+
} else if (!!document.all || !!document.documentMode) {
|
|
47
|
+
browser.name = "ie";
|
|
48
|
+
browser.version = getIEVersion();
|
|
49
|
+
browser.ie = true;
|
|
50
|
+
} else if (typeof window.InstallTrigger !== "undefined") {
|
|
51
|
+
browser.name = "firefox";
|
|
52
|
+
browser.firefox = true;
|
|
53
|
+
} else if (Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0) {
|
|
54
|
+
browser.name = "safari";
|
|
55
|
+
browser.safari = true;
|
|
56
|
+
} else if (!!window.opr && !!window.opr.addons || !!window.opera) {
|
|
57
|
+
browser.name = "opera";
|
|
58
|
+
browser.opera = true;
|
|
59
|
+
}
|
|
60
|
+
isEdge(browser);
|
|
61
|
+
if (!~["ie", "chrome"].indexOf(browser.name)) {
|
|
62
|
+
const reg = browser.name + "/(\\d+)";
|
|
63
|
+
matches = navigator.userAgent.match(new RegExp(reg, "i"));
|
|
64
|
+
browser.version = !!matches && !!matches[1] && parseInt(matches[1], 10);
|
|
65
|
+
matches = void 0;
|
|
66
|
+
}
|
|
67
|
+
if (browser.isDoc) {
|
|
68
|
+
const bodyEl = document.body || document.documentElement;
|
|
69
|
+
["webkit", "khtml", "moz", "ms", "o"].forEach((core) => {
|
|
70
|
+
browser["-" + core] = !!bodyEl[core + "MatchesSelector"];
|
|
71
|
+
});
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
return browser;
|
|
70
75
|
})();
|
|
71
76
|
export {
|
|
72
|
-
browser_default as default
|
|
77
|
+
browser_default as default,
|
|
78
|
+
isBrowser
|
|
73
79
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../../chunk-PKUHTIDK.js";
|
|
2
2
|
import { on, off } from "./dom";
|
|
3
|
+
import { isBrowser } from "../browser";
|
|
3
4
|
const MapShim = function() {
|
|
4
5
|
if (typeof Map !== "undefined") {
|
|
5
6
|
return Map;
|
|
@@ -64,8 +65,7 @@ const MapShim = function() {
|
|
|
64
65
|
return obClass;
|
|
65
66
|
}();
|
|
66
67
|
}();
|
|
67
|
-
const func = window.Function;
|
|
68
|
-
const isBrowser = window !== "undefined" && document !== "undefined" && window.document === document;
|
|
68
|
+
const func = isBrowser ? window.Function : global.Function;
|
|
69
69
|
const global$1 = function() {
|
|
70
70
|
const isMath = (val) => val.Math === Math;
|
|
71
71
|
if (typeof global !== "undefined" && isMath(global)) {
|
package/common/deps/popper.js
CHANGED
|
@@ -5,7 +5,6 @@ import { on, off } from "./dom";
|
|
|
5
5
|
import PopupManager from "./popup-manager";
|
|
6
6
|
import { typeOf } from "../type";
|
|
7
7
|
import { xss } from "../xss";
|
|
8
|
-
const win = window;
|
|
9
8
|
const positions = ["left", "right", "top", "bottom"];
|
|
10
9
|
const modifiers = ["shift", "offset", "preventOverflow", "keepTogether", "arrow", "flip", "applyStyle"];
|
|
11
10
|
const DEFAULTS = {
|
|
@@ -35,7 +34,7 @@ const setStyle = (el, styles) => {
|
|
|
35
34
|
};
|
|
36
35
|
const getSupportedPropertyName = (property) => {
|
|
37
36
|
let prefixes = ["", "ms", "webkit", "moz", "o"];
|
|
38
|
-
let bodyEl =
|
|
37
|
+
let bodyEl = window.document.body;
|
|
39
38
|
for (let i = 0; i < prefixes.length; i++) {
|
|
40
39
|
let toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
|
|
41
40
|
if (typeof bodyEl.style[toCheck] !== "undefined") {
|
|
@@ -57,23 +56,26 @@ const addAttributes = (el, attributes) => {
|
|
|
57
56
|
};
|
|
58
57
|
const getOffsetParent = (el) => {
|
|
59
58
|
let offsetParent = el.offsetParent;
|
|
60
|
-
return offsetParent ===
|
|
59
|
+
return offsetParent === window.document.body || !offsetParent ? window.document.documentElement : offsetParent;
|
|
61
60
|
};
|
|
62
61
|
const getStyleComputedProperty = (el, property) => {
|
|
63
62
|
if (!el || el.nodeType !== 1) {
|
|
64
63
|
return;
|
|
65
64
|
}
|
|
66
|
-
let css =
|
|
65
|
+
let css = window.getComputedStyle(el, null);
|
|
67
66
|
return css[property];
|
|
68
67
|
};
|
|
69
|
-
const isFixed = (el) => {
|
|
70
|
-
if (el ===
|
|
68
|
+
const isFixed = (el, offsetParent) => {
|
|
69
|
+
if (el === window.document.body) {
|
|
71
70
|
return false;
|
|
72
71
|
}
|
|
73
72
|
if (getStyleComputedProperty(el, "position") === "fixed") {
|
|
74
73
|
return true;
|
|
75
74
|
}
|
|
76
|
-
|
|
75
|
+
if (el === offsetParent) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return el.parentNode ? isFixed(el.parentNode, offsetParent) : false;
|
|
77
79
|
};
|
|
78
80
|
const getBoundingClientRect = (el) => {
|
|
79
81
|
let rectObj = el.getBoundingClientRect();
|
|
@@ -97,11 +99,11 @@ const getScrollParent = (el) => {
|
|
|
97
99
|
if (!parent) {
|
|
98
100
|
return el;
|
|
99
101
|
}
|
|
100
|
-
if (parent ===
|
|
101
|
-
if (
|
|
102
|
-
return
|
|
102
|
+
if (parent === window.document) {
|
|
103
|
+
if (window.document.body.scrollTop || window.document.body.scrollLeft) {
|
|
104
|
+
return window.document.body;
|
|
103
105
|
}
|
|
104
|
-
return
|
|
106
|
+
return window.document.documentElement;
|
|
105
107
|
}
|
|
106
108
|
if (isScrollElement(parent)) {
|
|
107
109
|
return parent;
|
|
@@ -140,7 +142,7 @@ const getOuterSizes = (el) => {
|
|
|
140
142
|
let _visibility = el.style.visibility;
|
|
141
143
|
el.style.display = "block";
|
|
142
144
|
el.style.visibility = "hidden";
|
|
143
|
-
let styles =
|
|
145
|
+
let styles = window.getComputedStyle(el);
|
|
144
146
|
let x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
145
147
|
let y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
146
148
|
let result = { width: el.offsetWidth + y, height: el.offsetHeight + x };
|
|
@@ -253,12 +255,12 @@ Popper.prototype.parse = function(config) {
|
|
|
253
255
|
classNames: ["popper"],
|
|
254
256
|
content: "",
|
|
255
257
|
contentType: "text",
|
|
256
|
-
parent:
|
|
258
|
+
parent: window.document.body,
|
|
257
259
|
tagName: "div"
|
|
258
260
|
};
|
|
259
261
|
config = __spreadValues(__spreadValues({}, defaultConfig), config);
|
|
260
262
|
const { tagName, classNames, attributes, contentType, content, arrowTagName } = config;
|
|
261
|
-
let docEl =
|
|
263
|
+
let docEl = window.document;
|
|
262
264
|
let popper = docEl.createElement(tagName);
|
|
263
265
|
addClassNames(popper, classNames);
|
|
264
266
|
addAttributes(popper, attributes);
|
|
@@ -291,11 +293,11 @@ Popper.prototype.parse = function(config) {
|
|
|
291
293
|
return popper;
|
|
292
294
|
};
|
|
293
295
|
Popper.prototype._getPosition = function(popper, reference) {
|
|
294
|
-
let
|
|
296
|
+
let offsetParent = getOffsetParent(reference);
|
|
295
297
|
if (this._options.forceAbsolute) {
|
|
296
298
|
return "absolute";
|
|
297
299
|
}
|
|
298
|
-
let isParentFixed = isFixed(reference,
|
|
300
|
+
let isParentFixed = isFixed(reference, offsetParent);
|
|
299
301
|
return isParentFixed ? "fixed" : "absolute";
|
|
300
302
|
};
|
|
301
303
|
Popper.prototype._getOffsets = function(popper, reference, placement) {
|
|
@@ -329,11 +331,11 @@ Popper.prototype._getOffsets = function(popper, reference, placement) {
|
|
|
329
331
|
};
|
|
330
332
|
Popper.prototype._setupEventListeners = function() {
|
|
331
333
|
this.state.updateBound = this.update.bind(this);
|
|
332
|
-
on(
|
|
334
|
+
on(window, "resize", this.state.updateBound);
|
|
333
335
|
if (this._options.boundariesElement !== "window") {
|
|
334
336
|
let target = getScrollParent(this._reference);
|
|
335
|
-
if (target ===
|
|
336
|
-
target =
|
|
337
|
+
if (target === window.document.body || target === window.document.documentElement) {
|
|
338
|
+
target = window;
|
|
337
339
|
}
|
|
338
340
|
this.state.scrollTarget = target;
|
|
339
341
|
if (this._options.bubbling || PopupManager.globalScroll) {
|
|
@@ -348,7 +350,7 @@ Popper.prototype._setupEventListeners = function() {
|
|
|
348
350
|
}
|
|
349
351
|
};
|
|
350
352
|
Popper.prototype._removeEventListeners = function() {
|
|
351
|
-
off(
|
|
353
|
+
off(window, "resize", this.state.updateBound);
|
|
352
354
|
if (this._options.boundariesElement !== "window" && this.state.scrollTarget) {
|
|
353
355
|
off(this.state.scrollTarget, "scroll", this.state.updateBound);
|
|
354
356
|
this.state.scrollTarget = null;
|
|
@@ -365,8 +367,8 @@ Popper.prototype._removeEventListeners = function() {
|
|
|
365
367
|
Popper.prototype._getBoundaries = function(data, padding, boundariesElement) {
|
|
366
368
|
let boundaries = {};
|
|
367
369
|
if (boundariesElement === "window") {
|
|
368
|
-
let body =
|
|
369
|
-
let html =
|
|
370
|
+
let body = window.document.body;
|
|
371
|
+
let html = window.document.documentElement;
|
|
370
372
|
let { width, height } = getMaxWH(body, html);
|
|
371
373
|
boundaries = { top: 0, right: width, bottom: height, left: 0 };
|
|
372
374
|
} else if (boundariesElement === "viewport") {
|
|
@@ -378,8 +380,8 @@ Popper.prototype._getBoundaries = function(data, padding, boundariesElement) {
|
|
|
378
380
|
let scrollLeft = isFixed2 ? 0 : getScrollLeftValue(scrollParent);
|
|
379
381
|
boundaries = {
|
|
380
382
|
top: 0 - (offsetParentRect.top - scrollTop),
|
|
381
|
-
right:
|
|
382
|
-
bottom:
|
|
383
|
+
right: window.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
|
|
384
|
+
bottom: window.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
|
|
383
385
|
left: 0 - (offsetParentRect.left - scrollLeft)
|
|
384
386
|
};
|
|
385
387
|
} else {
|
package/common/validate/util.js
CHANGED
|
@@ -139,7 +139,7 @@ function asyncMap(objArray, option, func, callback) {
|
|
|
139
139
|
const flattenArr = flattenObjArr(objArray);
|
|
140
140
|
asyncSerialArray(flattenArr, func, next);
|
|
141
141
|
});
|
|
142
|
-
pending2.catch((error) => log.logger.error(error));
|
|
142
|
+
pending2.catch((error) => error.errors && error.fields || log.logger.error(error));
|
|
143
143
|
return pending2;
|
|
144
144
|
}
|
|
145
145
|
let firstFields = option.firstFields || [];
|
|
@@ -169,7 +169,7 @@ function asyncMap(objArray, option, func, callback) {
|
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
|
-
pending.catch((error) => log.logger.error(error));
|
|
172
|
+
pending.catch((error) => error.errors && error.fields || log.logger.error(error));
|
|
173
173
|
return pending;
|
|
174
174
|
}
|
|
175
175
|
function complementError(rule) {
|
package/drawer/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
2
|
import debounce from "../common/deps/debounce";
|
|
3
|
+
import { addClass, removeClass } from "../common/deps/dom";
|
|
3
4
|
const close = ({ emit, state }) => () => {
|
|
4
5
|
state.toggle = false;
|
|
5
6
|
emit("close", state);
|
|
@@ -70,14 +71,28 @@ const removeDragEvent = ({ api, vm }) => () => {
|
|
|
70
71
|
el.removeEventListener("touchmove", api.mousemove);
|
|
71
72
|
el.removeEventListener("touchend", api.mouseup);
|
|
72
73
|
};
|
|
74
|
+
const showScrollbar = (lockScrollClass) => () => {
|
|
75
|
+
addClass(document.body, lockScrollClass);
|
|
76
|
+
};
|
|
77
|
+
const hideScrollbar = (lockScrollClass) => () => {
|
|
78
|
+
removeClass(document.body, lockScrollClass);
|
|
79
|
+
};
|
|
80
|
+
const watchVisibleNotImmediate = ({ api, props }) => (visible) => {
|
|
81
|
+
if (props.lockScroll) {
|
|
82
|
+
visible ? api.showScrollbar() : api.hideScrollbar();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
73
85
|
export {
|
|
74
86
|
addDragEvent,
|
|
75
87
|
close,
|
|
76
88
|
confirm,
|
|
89
|
+
hideScrollbar,
|
|
77
90
|
mousedown,
|
|
78
91
|
mousemove,
|
|
79
92
|
mouseup,
|
|
80
93
|
removeDragEvent,
|
|
94
|
+
showScrollbar,
|
|
81
95
|
watchToggle,
|
|
82
|
-
watchVisible
|
|
96
|
+
watchVisible,
|
|
97
|
+
watchVisibleNotImmediate
|
|
83
98
|
};
|
package/drawer/vue.js
CHANGED
|
@@ -8,10 +8,14 @@ import {
|
|
|
8
8
|
mouseup,
|
|
9
9
|
mousemove,
|
|
10
10
|
addDragEvent,
|
|
11
|
-
removeDragEvent
|
|
11
|
+
removeDragEvent,
|
|
12
|
+
showScrollbar,
|
|
13
|
+
hideScrollbar,
|
|
14
|
+
watchVisibleNotImmediate
|
|
12
15
|
} from "./index";
|
|
13
16
|
const api = ["state", "close", "confirm"];
|
|
14
|
-
const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { emit, vm }) => {
|
|
17
|
+
const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { emit, vm, mode, constants }) => {
|
|
18
|
+
const lockScrollClass = constants.SCROLL_LOCK_CLASS(mode);
|
|
15
19
|
const api2 = {};
|
|
16
20
|
const state = reactive({
|
|
17
21
|
toggle: false,
|
|
@@ -29,13 +33,20 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
|
|
|
29
33
|
addDragEvent: addDragEvent({ api: api2, vm }),
|
|
30
34
|
removeDragEvent: removeDragEvent({ api: api2, vm }),
|
|
31
35
|
watchVisible: watchVisible({ state }),
|
|
32
|
-
watchToggle: watchToggle({ emit })
|
|
36
|
+
watchToggle: watchToggle({ emit }),
|
|
37
|
+
showScrollbar: showScrollbar(lockScrollClass),
|
|
38
|
+
hideScrollbar: hideScrollbar(lockScrollClass),
|
|
39
|
+
watchVisibleNotImmediate: watchVisibleNotImmediate({ api: api2, props })
|
|
33
40
|
});
|
|
34
41
|
onMounted(() => {
|
|
35
42
|
props.dragable && api2.addDragEvent();
|
|
43
|
+
if (props.lockScroll && props.visible) {
|
|
44
|
+
api2.showScrollbar();
|
|
45
|
+
}
|
|
36
46
|
});
|
|
37
47
|
onBeforeUnmount(() => {
|
|
38
48
|
props.dragable && api2.removeDragEvent();
|
|
49
|
+
props.lockScroll && api2.hideScrollbar();
|
|
39
50
|
});
|
|
40
51
|
watch(() => props.visible, api2.watchVisible, { immediate: true });
|
|
41
52
|
watch(() => state.toggle, api2.watchToggle);
|
package/dropdown-menu/index.js
CHANGED
|
@@ -88,6 +88,9 @@ const useVuePopper = ({ api, props, hooks, instance, state }) => {
|
|
|
88
88
|
dropdown.popperElm = popper.popperElm.value = vm.$el;
|
|
89
89
|
popper.referenceElm.value = dropdown.$el;
|
|
90
90
|
dropdown.initDomOperation();
|
|
91
|
+
if (dropdown.inheritWidth) {
|
|
92
|
+
dropdown.popperElm.style.minWidth = dropdown.$el.clientWidth + "px";
|
|
93
|
+
}
|
|
91
94
|
});
|
|
92
95
|
onBeforeUnmount(() => {
|
|
93
96
|
popper.destroyPopper("remove");
|
package/dropdown-menu/vue.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import "../chunk-PKUHTIDK.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
toggleItem,
|
|
4
|
+
updateOffset,
|
|
5
|
+
clickOutside,
|
|
6
|
+
getScroller,
|
|
7
|
+
useVuePopper,
|
|
8
|
+
mounted,
|
|
9
|
+
handleMenuItemClick,
|
|
10
|
+
handleMouseenter,
|
|
11
|
+
handleMouseleave
|
|
12
|
+
} from "./index";
|
|
13
|
+
const api = [
|
|
14
|
+
"state",
|
|
15
|
+
"toggleItem",
|
|
16
|
+
"updateOffset",
|
|
17
|
+
"clickOutside",
|
|
18
|
+
"doDestroy",
|
|
19
|
+
"handleMouseenter",
|
|
20
|
+
"handleMouseleave"
|
|
21
|
+
];
|
|
4
22
|
const renderless = (props, hooks, instance) => {
|
|
5
23
|
const api2 = {};
|
|
6
24
|
const { reactive, provide, onMounted } = hooks;
|
package/grid/utils/dom.js
CHANGED
|
@@ -5,8 +5,6 @@ import { arrayIndexOf } from "../static";
|
|
|
5
5
|
const ATTR_NAME = "data-rowid";
|
|
6
6
|
const CELL_CLS = ".tiny-grid-cell";
|
|
7
7
|
const ROW_CLS = ".tiny-grid-body__row";
|
|
8
|
-
const htmlEl = document.querySelector("html");
|
|
9
|
-
const bodyEl = document.body;
|
|
10
8
|
const isPx = (val) => val && /^\d+(px)?$/.test(val);
|
|
11
9
|
const isScale = (val) => val && /^\d+%$/.test(val);
|
|
12
10
|
const updateCellTitle = (event) => {
|
|
@@ -126,6 +124,8 @@ const getEventTargetNode = (event, container, queryCls) => {
|
|
|
126
124
|
};
|
|
127
125
|
function getNodeOffset(el, container, rest) {
|
|
128
126
|
if (el) {
|
|
127
|
+
const htmlEl = document.querySelector("html");
|
|
128
|
+
const bodyEl = document.body;
|
|
129
129
|
const parentEl = el.parentNode;
|
|
130
130
|
rest.top += el.offsetTop;
|
|
131
131
|
rest.left += el.offsetLeft;
|