@fangzhongya/fang-ui 0.1.44 → 0.1.45
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/dist/components/buttons/src/index2.cjs +15 -8
- package/dist/components/buttons/src/index2.js +13 -6
- package/dist/components/common/use.cjs +34 -27
- package/dist/components/common/use.js +14 -7
- package/dist/components/dates/src/data.cjs +6 -0
- package/dist/components/dates/src/data.d.ts +6 -0
- package/dist/components/dates/src/data.js +6 -0
- package/dist/components/dates/src/index2.cjs +12 -1
- package/dist/components/dates/src/index2.js +12 -1
- package/dist/components/dates-divide/src/data.cjs +7 -1
- package/dist/components/dates-divide/src/data.d.ts +6 -0
- package/dist/components/dates-divide/src/data.js +7 -1
- package/dist/components/dates-divide/src/index2.cjs +13 -4
- package/dist/components/dates-divide/src/index2.js +13 -4
- package/dist/components/dates-picker/src/data.cjs +6 -0
- package/dist/components/dates-picker/src/data.d.ts +12 -0
- package/dist/components/dates-picker/src/data.js +6 -0
- package/dist/components/dates-picker/src/index2.cjs +11 -0
- package/dist/components/dates-picker/src/index2.js +11 -0
- package/dist/components/dates2/src/data.cjs +6 -0
- package/dist/components/dates2/src/data.d.ts +6 -0
- package/dist/components/dates2/src/data.js +6 -0
- package/dist/components/dates2/src/index2.cjs +12 -0
- package/dist/components/dates2/src/index2.js +12 -0
- package/dist/components/tables/common/com-but2.cjs +9 -13
- package/dist/components/tables/common/com-but2.js +7 -11
- package/dist/components/tables/common/com-color2.cjs +7 -11
- package/dist/components/tables/common/com-color2.js +8 -12
- package/dist/components/tables/common/com-lis2.cjs +7 -10
- package/dist/components/tables/common/com-lis2.js +8 -11
- package/dist/components/tables/common/util.cjs +0 -88
- package/dist/components/tables/common/util.d.ts +0 -8
- package/dist/components/tables/common/util.js +1 -89
- package/dist/hooks/event-aliass/index.cjs +121 -0
- package/dist/hooks/event-aliass/index.d.ts +1 -0
- package/dist/hooks/event-aliass/index.js +121 -0
- package/dist/icons/index.json +1 -1
- package/dist/utils/vues/common.d.ts +0 -8
- package/package.json +3 -3
- /package/dist/components/{global-config → keep-com}/index.css +0 -0
- /package/dist/css/{global-config.css → keep-com.css} +0 -0
|
@@ -78,6 +78,12 @@ export declare const dataProps: {
|
|
|
78
78
|
readonly [Symbol.species]: ArrayConstructor;
|
|
79
79
|
})[];
|
|
80
80
|
};
|
|
81
|
+
disabledDate: {
|
|
82
|
+
type: FunctionConstructor;
|
|
83
|
+
};
|
|
84
|
+
disabledNot: {
|
|
85
|
+
type: BooleanConstructor;
|
|
86
|
+
};
|
|
81
87
|
options: {
|
|
82
88
|
type: {
|
|
83
89
|
(arrayLength: number): ObjAny[];
|
|
@@ -10,6 +10,7 @@ const index$4 = require("../../selects/index.cjs");
|
|
|
10
10
|
const index$6 = require("../../date-picker/index.cjs");
|
|
11
11
|
const index$3 = require("../../../hooks/props-default/index.cjs");
|
|
12
12
|
const index = require("../../../hooks/locale/index.cjs");
|
|
13
|
+
const getEndOfDay = require("@fangzhongya/utils/date/getEndOfDay");
|
|
13
14
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
14
15
|
__name: "index",
|
|
15
16
|
props: index$3.getProps(data.dataProps),
|
|
@@ -50,6 +51,15 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
50
51
|
const format = attrs.assem["value-format"] || props.format || ((_a = types.value) == null ? void 0 : _a.format);
|
|
51
52
|
return util.formatType(value2, format, types.value, props.repair);
|
|
52
53
|
}
|
|
54
|
+
const disabledDate = function(data2) {
|
|
55
|
+
if (props.disabledDate) {
|
|
56
|
+
return props.disabledDate(data2);
|
|
57
|
+
} else if (props.disabledNot) {
|
|
58
|
+
const d = getEndOfDay.getEndOfDay();
|
|
59
|
+
return data2 > d;
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
};
|
|
53
63
|
__expose({
|
|
54
64
|
...data.dataExpose,
|
|
55
65
|
getValue
|
|
@@ -77,6 +87,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
77
87
|
type: ((_a = types.value) == null ? void 0 : _a.type) || vue.unref(props).type,
|
|
78
88
|
format: vue.unref(props).format || ((_b = types.value) == null ? void 0 : _b.format),
|
|
79
89
|
"default-time": defaultTime,
|
|
90
|
+
"disabled-date": disabledDate,
|
|
80
91
|
modelValue: vue.unref(value),
|
|
81
92
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(value) ? value.value = $event : null)
|
|
82
93
|
}), null, 16, ["type", "format", "modelValue"])
|
|
@@ -85,6 +96,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
85
96
|
format: vue.unref(props).format || ((_c = types.value) == null ? void 0 : _c.format),
|
|
86
97
|
"default-time": vue.unref(multiple) ? defaultTime : void 0,
|
|
87
98
|
shortcuts: vue.unref(props).shortcuts,
|
|
99
|
+
"disabled-date": disabledDate,
|
|
88
100
|
modelValue: vue.unref(value),
|
|
89
101
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(value) ? value.value = $event : null)
|
|
90
102
|
}), vue.createSlots({ _: 2 }, [
|
|
@@ -8,6 +8,7 @@ import { Selects } from "../../selects/index.js";
|
|
|
8
8
|
import { DatePicker } from "../../date-picker/index.js";
|
|
9
9
|
import { usePropsDefault, getProps } from "../../../hooks/props-default/index.js";
|
|
10
10
|
import { useLocale } from "../../../hooks/locale/index.js";
|
|
11
|
+
import { getEndOfDay } from "@fangzhongya/utils/date/getEndOfDay";
|
|
11
12
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
13
|
__name: "index",
|
|
13
14
|
props: getProps(dataProps),
|
|
@@ -48,6 +49,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
48
49
|
const format = attrs.assem["value-format"] || props.format || ((_a = types.value) == null ? void 0 : _a.format);
|
|
49
50
|
return formatType(value2, format, types.value, props.repair);
|
|
50
51
|
}
|
|
52
|
+
const disabledDate = function(data) {
|
|
53
|
+
if (props.disabledDate) {
|
|
54
|
+
return props.disabledDate(data);
|
|
55
|
+
} else if (props.disabledNot) {
|
|
56
|
+
const d = getEndOfDay();
|
|
57
|
+
return data > d;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
};
|
|
51
61
|
__expose({
|
|
52
62
|
...dataExpose,
|
|
53
63
|
getValue
|
|
@@ -75,6 +85,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
75
85
|
type: ((_a = types.value) == null ? void 0 : _a.type) || unref(props).type,
|
|
76
86
|
format: unref(props).format || ((_b = types.value) == null ? void 0 : _b.format),
|
|
77
87
|
"default-time": defaultTime,
|
|
88
|
+
"disabled-date": disabledDate,
|
|
78
89
|
modelValue: unref(value),
|
|
79
90
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(value) ? value.value = $event : null)
|
|
80
91
|
}), null, 16, ["type", "format", "modelValue"])
|
|
@@ -83,6 +94,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
83
94
|
format: unref(props).format || ((_c = types.value) == null ? void 0 : _c.format),
|
|
84
95
|
"default-time": unref(multiple) ? defaultTime : void 0,
|
|
85
96
|
shortcuts: unref(props).shortcuts,
|
|
97
|
+
"disabled-date": disabledDate,
|
|
86
98
|
modelValue: unref(value),
|
|
87
99
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(value) ? value.value = $event : null)
|
|
88
100
|
}), createSlots({ _: 2 }, [
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vue = require("vue");
|
|
4
|
-
const index$
|
|
4
|
+
const index$2 = require("../../button/index.cjs");
|
|
5
5
|
const index = require("../../../hooks/cssname/index.cjs");
|
|
6
|
-
const
|
|
6
|
+
const index$1 = require("../../../hooks/event-aliass/index.cjs");
|
|
7
7
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
8
8
|
__name: "com-but",
|
|
9
9
|
props: {
|
|
@@ -78,21 +78,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
78
78
|
}
|
|
79
79
|
function onClick(obj, index2, $event) {
|
|
80
80
|
var _a;
|
|
81
|
-
|
|
81
|
+
const is = index$1.eventAliass(
|
|
82
82
|
(callback) => {
|
|
83
|
-
callback(
|
|
84
|
-
"but",
|
|
85
|
-
obj,
|
|
86
|
-
props.valueobj,
|
|
87
|
-
props.listobj,
|
|
88
|
-
props.comscope
|
|
89
|
-
);
|
|
83
|
+
callback(obj, props.valueobj, props.listobj, props.comscope);
|
|
90
84
|
},
|
|
91
85
|
"click",
|
|
92
|
-
((_a = props.listobj) == null ? void 0 : _a.events) ||
|
|
86
|
+
((_a = props.listobj) == null ? void 0 : _a.events) || obj,
|
|
93
87
|
$event
|
|
94
88
|
);
|
|
95
|
-
|
|
89
|
+
if (!is) {
|
|
90
|
+
emit("but", obj);
|
|
91
|
+
}
|
|
96
92
|
}
|
|
97
93
|
return (_ctx, _cache) => {
|
|
98
94
|
return vue.openBlock(), vue.createElementBlock("span", {
|
|
@@ -100,7 +96,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
100
96
|
}, [
|
|
101
97
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.list, (item, index2) => {
|
|
102
98
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: index2 }, [
|
|
103
|
-
getHide(item) ? (vue.openBlock(), vue.createBlock(vue.unref(index$
|
|
99
|
+
getHide(item) ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.Button), vue.mergeProps({
|
|
104
100
|
key: 0,
|
|
105
101
|
ref_for: true
|
|
106
102
|
}, item, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createBlock, createCommentVNode, mergeProps, withCtx, createTextVNode, toDisplayString } from "vue";
|
|
2
2
|
import { Button } from "../../button/index.js";
|
|
3
3
|
import { useCssName } from "../../../hooks/cssname/index.js";
|
|
4
|
-
import { eventAliass } from "
|
|
4
|
+
import { eventAliass } from "../../../hooks/event-aliass/index.js";
|
|
5
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
6
|
__name: "com-but",
|
|
7
7
|
props: {
|
|
@@ -76,21 +76,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
76
76
|
}
|
|
77
77
|
function onClick(obj, index, $event) {
|
|
78
78
|
var _a;
|
|
79
|
-
eventAliass(
|
|
79
|
+
const is = eventAliass(
|
|
80
80
|
(callback) => {
|
|
81
|
-
callback(
|
|
82
|
-
"but",
|
|
83
|
-
obj,
|
|
84
|
-
props.valueobj,
|
|
85
|
-
props.listobj,
|
|
86
|
-
props.comscope
|
|
87
|
-
);
|
|
81
|
+
callback(obj, props.valueobj, props.listobj, props.comscope);
|
|
88
82
|
},
|
|
89
83
|
"click",
|
|
90
|
-
((_a = props.listobj) == null ? void 0 : _a.events) ||
|
|
84
|
+
((_a = props.listobj) == null ? void 0 : _a.events) || obj,
|
|
91
85
|
$event
|
|
92
86
|
);
|
|
93
|
-
|
|
87
|
+
if (!is) {
|
|
88
|
+
emit("but", obj);
|
|
89
|
+
}
|
|
94
90
|
}
|
|
95
91
|
return (_ctx, _cache) => {
|
|
96
92
|
return openBlock(), createElementBlock("span", {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const util = require("./util.cjs");
|
|
5
|
+
const index$1 = require("../../../hooks/event-aliass/index.cjs");
|
|
5
6
|
const index = require("../../../hooks/cssname/index.cjs");
|
|
6
7
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
7
8
|
__name: "com-color",
|
|
@@ -100,22 +101,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
100
101
|
}
|
|
101
102
|
function onClick($event) {
|
|
102
103
|
var _a;
|
|
103
|
-
const
|
|
104
|
-
util.eventAliass(
|
|
104
|
+
const is = index$1.eventAliass(
|
|
105
105
|
(callback) => {
|
|
106
|
-
callback(
|
|
107
|
-
"color",
|
|
108
|
-
obj,
|
|
109
|
-
props.valueobj,
|
|
110
|
-
props.listobj,
|
|
111
|
-
props.comscope
|
|
112
|
-
);
|
|
106
|
+
callback(props, props.valueobj, props.listobj, props.comscope);
|
|
113
107
|
},
|
|
114
108
|
"click",
|
|
115
|
-
((_a = props.listobj) == null ? void 0 : _a.events) ||
|
|
109
|
+
((_a = props.listobj) == null ? void 0 : _a.events) || props,
|
|
116
110
|
$event
|
|
117
111
|
);
|
|
118
|
-
|
|
112
|
+
if (!is) {
|
|
113
|
+
emit("color", props);
|
|
114
|
+
}
|
|
119
115
|
}
|
|
120
116
|
return (_ctx, _cache) => {
|
|
121
117
|
return emptyDisplay.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, createElementBlock, openBlock, Fragment, createTextVNode, toDisplayString, normalizeStyle, normalizeClass, unref, createElementVNode } from "vue";
|
|
2
|
-
import { setEmptyDisplay
|
|
2
|
+
import { setEmptyDisplay } from "./util.js";
|
|
3
|
+
import { eventAliass } from "../../../hooks/event-aliass/index.js";
|
|
3
4
|
import { useCssName } from "../../../hooks/cssname/index.js";
|
|
4
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
6
|
__name: "com-color",
|
|
@@ -98,22 +99,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
98
99
|
}
|
|
99
100
|
function onClick($event) {
|
|
100
101
|
var _a;
|
|
101
|
-
const
|
|
102
|
-
eventAliass(
|
|
102
|
+
const is = eventAliass(
|
|
103
103
|
(callback) => {
|
|
104
|
-
callback(
|
|
105
|
-
"color",
|
|
106
|
-
obj,
|
|
107
|
-
props.valueobj,
|
|
108
|
-
props.listobj,
|
|
109
|
-
props.comscope
|
|
110
|
-
);
|
|
104
|
+
callback(props, props.valueobj, props.listobj, props.comscope);
|
|
111
105
|
},
|
|
112
106
|
"click",
|
|
113
|
-
((_a = props.listobj) == null ? void 0 : _a.events) ||
|
|
107
|
+
((_a = props.listobj) == null ? void 0 : _a.events) || props,
|
|
114
108
|
$event
|
|
115
109
|
);
|
|
116
|
-
|
|
110
|
+
if (!is) {
|
|
111
|
+
emit("color", props);
|
|
112
|
+
}
|
|
117
113
|
}
|
|
118
114
|
return (_ctx, _cache) => {
|
|
119
115
|
return emptyDisplay.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const util = require("./util.cjs");
|
|
5
|
+
const index$1 = require("../../../hooks/event-aliass/index.cjs");
|
|
5
6
|
const use = require("../../common/use.cjs");
|
|
6
7
|
const index = require("../../../hooks/cssname/index.cjs");
|
|
7
8
|
const _hoisted_1 = ["onClick"];
|
|
@@ -112,21 +113,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
112
113
|
});
|
|
113
114
|
function onClickList(obj, index2, $event) {
|
|
114
115
|
var _a;
|
|
115
|
-
|
|
116
|
+
const is = index$1.eventAliass(
|
|
116
117
|
(callback) => {
|
|
117
|
-
callback(
|
|
118
|
-
"lis",
|
|
119
|
-
obj,
|
|
120
|
-
props.valueobj,
|
|
121
|
-
props.listobj,
|
|
122
|
-
props.comscope
|
|
123
|
-
);
|
|
118
|
+
callback(obj, props.valueobj, props.listobj, props.comscope);
|
|
124
119
|
},
|
|
125
120
|
"click",
|
|
126
|
-
((_a = props.listobj) == null ? void 0 : _a.events) ||
|
|
121
|
+
((_a = props.listobj) == null ? void 0 : _a.events) || obj,
|
|
127
122
|
$event
|
|
128
123
|
);
|
|
129
|
-
|
|
124
|
+
if (!is) {
|
|
125
|
+
emit("lis", obj, index2);
|
|
126
|
+
}
|
|
130
127
|
}
|
|
131
128
|
return (_ctx, _cache) => {
|
|
132
129
|
return emptyDisplay.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, createElementBlock, openBlock, Fragment, createTextVNode, toDisplayString, normalizeClass, unref, renderList, normalizeStyle } from "vue";
|
|
2
|
-
import { setEmptyDisplay
|
|
2
|
+
import { setEmptyDisplay } from "./util.js";
|
|
3
|
+
import { eventAliass } from "../../../hooks/event-aliass/index.js";
|
|
3
4
|
import { useGetDomValue } from "../../common/use.js";
|
|
4
5
|
import { useCssName } from "../../../hooks/cssname/index.js";
|
|
5
6
|
const _hoisted_1 = ["onClick"];
|
|
@@ -110,21 +111,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
110
111
|
});
|
|
111
112
|
function onClickList(obj, index, $event) {
|
|
112
113
|
var _a;
|
|
113
|
-
eventAliass(
|
|
114
|
+
const is = eventAliass(
|
|
114
115
|
(callback) => {
|
|
115
|
-
callback(
|
|
116
|
-
"lis",
|
|
117
|
-
obj,
|
|
118
|
-
props.valueobj,
|
|
119
|
-
props.listobj,
|
|
120
|
-
props.comscope
|
|
121
|
-
);
|
|
116
|
+
callback(obj, props.valueobj, props.listobj, props.comscope);
|
|
122
117
|
},
|
|
123
118
|
"click",
|
|
124
|
-
((_a = props.listobj) == null ? void 0 : _a.events) ||
|
|
119
|
+
((_a = props.listobj) == null ? void 0 : _a.events) || obj,
|
|
125
120
|
$event
|
|
126
121
|
);
|
|
127
|
-
|
|
122
|
+
if (!is) {
|
|
123
|
+
emit("lis", obj, index);
|
|
124
|
+
}
|
|
128
125
|
}
|
|
129
126
|
return (_ctx, _cache) => {
|
|
130
127
|
return emptyDisplay.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const use = require("../../common/use.cjs");
|
|
5
|
-
const firstUpper = require("@fangzhongya/utils/basic/string/firstUpper");
|
|
6
|
-
const splitUpper = require("@fangzhongya/utils/basic/string/splitUpper");
|
|
7
5
|
const getAttrValue = require("../../../utils/vues/getAttrValue.cjs");
|
|
8
6
|
const css = require("../../../utils/css.cjs");
|
|
9
7
|
function getVNodeWidth(vnode) {
|
|
@@ -67,91 +65,6 @@ function setMinWidth(obj, props) {
|
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
const eventAliasObj = {
|
|
71
|
-
//.stop - 调用 event.stopPropagation()。
|
|
72
|
-
stop(event) {
|
|
73
|
-
event.stopPropagation();
|
|
74
|
-
return true;
|
|
75
|
-
},
|
|
76
|
-
// .prevent - 调用 event.preventDefault()。
|
|
77
|
-
prevent(event) {
|
|
78
|
-
event.preventDefault();
|
|
79
|
-
return true;
|
|
80
|
-
},
|
|
81
|
-
// .self - 只有事件从元素本身发出才触发处理函数。
|
|
82
|
-
self(event) {
|
|
83
|
-
return event.target === event.currentTarget;
|
|
84
|
-
},
|
|
85
|
-
// .once - 最多触发一次处理函数。
|
|
86
|
-
once(event) {
|
|
87
|
-
var _a;
|
|
88
|
-
if ((_a = event.currentTarget) == null ? void 0 : _a.__once__) {
|
|
89
|
-
return false;
|
|
90
|
-
} else {
|
|
91
|
-
if (event.currentTarget) {
|
|
92
|
-
event.currentTarget.__once__ = true;
|
|
93
|
-
}
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// .capture - 在捕获模式添加事件监听器。
|
|
98
|
-
// 处理事件是异步的,只有在触发了事件后才执行方法,
|
|
99
|
-
// 目前无法支持 capture
|
|
100
|
-
// capture(event) {
|
|
101
|
-
// console.log('event', event);
|
|
102
|
-
// return true;
|
|
103
|
-
// },
|
|
104
|
-
};
|
|
105
|
-
function eventAlias(key, callback, obj, $event) {
|
|
106
|
-
let is = false;
|
|
107
|
-
const name = "on" + firstUpper.firstUpper(key);
|
|
108
|
-
const arr = [];
|
|
109
|
-
for (const k of Object.keys(obj)) {
|
|
110
|
-
if (k.startsWith(name)) {
|
|
111
|
-
arr.push(k);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const reg = new RegExp("^" + name);
|
|
115
|
-
for (const v of arr) {
|
|
116
|
-
let s = v.replace(reg, "");
|
|
117
|
-
if (s && $event) {
|
|
118
|
-
let ns = splitUpper.splitUpper(s);
|
|
119
|
-
if (ns.includes("passive")) {
|
|
120
|
-
ns = ns.filter((k) => {
|
|
121
|
-
return k != "prevent";
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
const fn = () => {
|
|
125
|
-
if (ns.includes("once")) {
|
|
126
|
-
let isc = eventAliasObj.once($event);
|
|
127
|
-
if (isc) {
|
|
128
|
-
callback(obj[v]);
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
callback(obj[v]);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
vue.withModifiers(fn, ns)();
|
|
135
|
-
} else {
|
|
136
|
-
callback(obj[v]);
|
|
137
|
-
}
|
|
138
|
-
is = true;
|
|
139
|
-
}
|
|
140
|
-
return is;
|
|
141
|
-
}
|
|
142
|
-
function eventAliass(callback, arr, obj, $event) {
|
|
143
|
-
if (!callback || !obj || !arr || arr.length === 0) {
|
|
144
|
-
return false;
|
|
145
|
-
}
|
|
146
|
-
let is = false;
|
|
147
|
-
const items = Array.isArray(arr) ? arr : [arr];
|
|
148
|
-
for (const key of items) {
|
|
149
|
-
if (eventAlias(key, callback, obj, $event)) {
|
|
150
|
-
is = true;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return is;
|
|
154
|
-
}
|
|
155
68
|
function setEmptyDisplay(value, emptyDisplay, isStr) {
|
|
156
69
|
if (isStr) {
|
|
157
70
|
if (value === "" || value === void 0 || value === null) {
|
|
@@ -161,6 +74,5 @@ function setEmptyDisplay(value, emptyDisplay, isStr) {
|
|
|
161
74
|
return emptyDisplay;
|
|
162
75
|
}
|
|
163
76
|
}
|
|
164
|
-
exports.eventAliass = eventAliass;
|
|
165
77
|
exports.setEmptyDisplay = setEmptyDisplay;
|
|
166
78
|
exports.setMinWidth = setMinWidth;
|
|
@@ -5,14 +5,6 @@
|
|
|
5
5
|
* @returns 返回设置的最小宽度值,可能为具体数值、函数执行结果或undefined
|
|
6
6
|
*/
|
|
7
7
|
export declare function setMinWidth(obj: ObjAny, props?: ObjAny): any;
|
|
8
|
-
/**
|
|
9
|
-
* 支持事件别名处理
|
|
10
|
-
* @param {*} callback
|
|
11
|
-
* @param {*} arr
|
|
12
|
-
* @param {*} obj
|
|
13
|
-
* @param {*} $event
|
|
14
|
-
*/
|
|
15
|
-
export declare function eventAliass(callback: Function, arr: string | string[], obj: ObjAny, $event: Event): boolean;
|
|
16
8
|
/**
|
|
17
9
|
* 设置空值显示内容
|
|
18
10
|
* @param value 需要检查的值
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { render, isVNode, h
|
|
1
|
+
import { render, isVNode, h } from "vue";
|
|
2
2
|
import { useGetDomLabel } from "../../common/use.js";
|
|
3
|
-
import { firstUpper } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
4
|
-
import { splitUpper } from "@fangzhongya/utils/basic/string/splitUpper";
|
|
5
3
|
import { getAttrValue } from "../../../utils/vues/getAttrValue.js";
|
|
6
4
|
import { getCssNumber } from "../../../utils/css.js";
|
|
7
5
|
function getVNodeWidth(vnode) {
|
|
@@ -65,91 +63,6 @@ function setMinWidth(obj, props) {
|
|
|
65
63
|
}
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
|
-
const eventAliasObj = {
|
|
69
|
-
//.stop - 调用 event.stopPropagation()。
|
|
70
|
-
stop(event) {
|
|
71
|
-
event.stopPropagation();
|
|
72
|
-
return true;
|
|
73
|
-
},
|
|
74
|
-
// .prevent - 调用 event.preventDefault()。
|
|
75
|
-
prevent(event) {
|
|
76
|
-
event.preventDefault();
|
|
77
|
-
return true;
|
|
78
|
-
},
|
|
79
|
-
// .self - 只有事件从元素本身发出才触发处理函数。
|
|
80
|
-
self(event) {
|
|
81
|
-
return event.target === event.currentTarget;
|
|
82
|
-
},
|
|
83
|
-
// .once - 最多触发一次处理函数。
|
|
84
|
-
once(event) {
|
|
85
|
-
var _a;
|
|
86
|
-
if ((_a = event.currentTarget) == null ? void 0 : _a.__once__) {
|
|
87
|
-
return false;
|
|
88
|
-
} else {
|
|
89
|
-
if (event.currentTarget) {
|
|
90
|
-
event.currentTarget.__once__ = true;
|
|
91
|
-
}
|
|
92
|
-
return true;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// .capture - 在捕获模式添加事件监听器。
|
|
96
|
-
// 处理事件是异步的,只有在触发了事件后才执行方法,
|
|
97
|
-
// 目前无法支持 capture
|
|
98
|
-
// capture(event) {
|
|
99
|
-
// console.log('event', event);
|
|
100
|
-
// return true;
|
|
101
|
-
// },
|
|
102
|
-
};
|
|
103
|
-
function eventAlias(key, callback, obj, $event) {
|
|
104
|
-
let is = false;
|
|
105
|
-
const name = "on" + firstUpper(key);
|
|
106
|
-
const arr = [];
|
|
107
|
-
for (const k of Object.keys(obj)) {
|
|
108
|
-
if (k.startsWith(name)) {
|
|
109
|
-
arr.push(k);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const reg = new RegExp("^" + name);
|
|
113
|
-
for (const v of arr) {
|
|
114
|
-
let s = v.replace(reg, "");
|
|
115
|
-
if (s && $event) {
|
|
116
|
-
let ns = splitUpper(s);
|
|
117
|
-
if (ns.includes("passive")) {
|
|
118
|
-
ns = ns.filter((k) => {
|
|
119
|
-
return k != "prevent";
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
const fn = () => {
|
|
123
|
-
if (ns.includes("once")) {
|
|
124
|
-
let isc = eventAliasObj.once($event);
|
|
125
|
-
if (isc) {
|
|
126
|
-
callback(obj[v]);
|
|
127
|
-
}
|
|
128
|
-
} else {
|
|
129
|
-
callback(obj[v]);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
withModifiers(fn, ns)();
|
|
133
|
-
} else {
|
|
134
|
-
callback(obj[v]);
|
|
135
|
-
}
|
|
136
|
-
is = true;
|
|
137
|
-
}
|
|
138
|
-
return is;
|
|
139
|
-
}
|
|
140
|
-
function eventAliass(callback, arr, obj, $event) {
|
|
141
|
-
if (!callback || !obj || !arr || arr.length === 0) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
let is = false;
|
|
145
|
-
const items = Array.isArray(arr) ? arr : [arr];
|
|
146
|
-
for (const key of items) {
|
|
147
|
-
if (eventAlias(key, callback, obj, $event)) {
|
|
148
|
-
is = true;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return is;
|
|
152
|
-
}
|
|
153
66
|
function setEmptyDisplay(value, emptyDisplay, isStr) {
|
|
154
67
|
if (isStr) {
|
|
155
68
|
if (value === "" || value === void 0 || value === null) {
|
|
@@ -160,7 +73,6 @@ function setEmptyDisplay(value, emptyDisplay, isStr) {
|
|
|
160
73
|
}
|
|
161
74
|
}
|
|
162
75
|
export {
|
|
163
|
-
eventAliass,
|
|
164
76
|
setEmptyDisplay,
|
|
165
77
|
setMinWidth
|
|
166
78
|
};
|