fast-element-plus 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh.md +4 -4
- package/dist/index.full.js +9 -41
- package/dist/index.full.js.map +1 -1
- package/dist/index.full.min.js +1 -35
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +1 -35
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +9 -41
- package/dist/index.full.mjs.map +1 -1
- package/es/component.mjs +1 -51
- package/es/component.mjs.map +1 -1
- package/es/components/avatar/index.mjs +1 -7
- package/es/components/avatar/index.mjs.map +1 -1
- package/es/components/avatar/src/avatar.mjs +1 -75
- package/es/components/avatar/src/avatar.mjs.map +1 -1
- package/es/components/button/index.mjs +1 -10
- package/es/components/button/index.mjs.map +1 -1
- package/es/components/button/src/button.mjs +1 -117
- package/es/components/button/src/button.mjs.map +1 -1
- package/es/components/carNumber/index.mjs +1 -11
- package/es/components/carNumber/index.mjs.map +1 -1
- package/es/components/carNumber/src/carNumber.d.ts +5 -5
- package/es/components/carNumber/src/carNumber.mjs +1 -163
- package/es/components/carNumber/src/carNumber.mjs.map +1 -1
- package/es/components/carNumber/src/common.mjs +1 -74
- package/es/components/carNumber/src/common.mjs.map +1 -1
- package/es/components/contextMenu/index.mjs +1 -8
- package/es/components/contextMenu/index.mjs.map +1 -1
- package/es/components/contextMenu/src/contextMenu.mjs +1 -84
- package/es/components/contextMenu/src/contextMenu.mjs.map +1 -1
- package/es/components/dialog/index.mjs +1 -10
- package/es/components/dialog/index.mjs.map +1 -1
- package/es/components/dialog/src/dialog.mjs +1 -284
- package/es/components/dialog/src/dialog.mjs.map +1 -1
- package/es/components/drawer/index.mjs +1 -7
- package/es/components/drawer/index.mjs.map +1 -1
- package/es/components/drawer/src/drawer.d.ts +9 -0
- package/es/components/drawer/src/drawer.mjs +1 -283
- package/es/components/drawer/src/drawer.mjs.map +1 -1
- package/es/components/form/index.mjs +1 -18
- package/es/components/form/index.mjs.map +1 -1
- package/es/components/form/src/form.mjs +1 -108
- package/es/components/form/src/form.mjs.map +1 -1
- package/es/components/form/src/formItem.mjs +1 -116
- package/es/components/form/src/formItem.mjs.map +1 -1
- package/es/components/form/utils/form.mjs +1 -216
- package/es/components/form/utils/form.mjs.map +1 -1
- package/es/components/formItemTip/index.mjs +1 -9
- package/es/components/formItemTip/index.mjs.map +1 -1
- package/es/components/formItemTip/src/formItemTip.mjs +1 -37
- package/es/components/formItemTip/src/formItemTip.mjs.map +1 -1
- package/es/components/icon/index.mjs +1 -7
- package/es/components/icon/index.mjs.map +1 -1
- package/es/components/icon/src/icon.mjs +1 -68
- package/es/components/icon/src/icon.mjs.map +1 -1
- package/es/components/iconSelector/index.mjs +1 -7
- package/es/components/iconSelector/index.mjs.map +1 -1
- package/es/components/iconSelector/src/iconSelector.mjs +1 -142
- package/es/components/iconSelector/src/iconSelector.mjs.map +1 -1
- package/es/components/image/index.mjs +1 -9
- package/es/components/image/index.mjs.map +1 -1
- package/es/components/image/src/image.mjs +1 -89
- package/es/components/image/src/image.mjs.map +1 -1
- package/es/components/index.mjs +1 -99
- package/es/components/index.mjs.map +1 -1
- package/es/components/layoutGrid/index.mjs +1 -13
- package/es/components/layoutGrid/index.mjs.map +1 -1
- package/es/components/layoutGrid/src/layoutGrid.mjs +1 -177
- package/es/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
- package/es/components/layoutGrid/src/layoutGridItem.mjs +1 -96
- package/es/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
- package/es/components/select/index.mjs +1 -16
- package/es/components/select/index.mjs.map +1 -1
- package/es/components/select/src/select.mjs +1 -558
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/select/src/selectOption.mjs +1 -70
- package/es/components/select/src/selectOption.mjs.map +1 -1
- package/es/components/selectPage/index.mjs +1 -10
- package/es/components/selectPage/index.mjs.map +1 -1
- package/es/components/selectPage/src/selectPage.mjs +1 -380
- package/es/components/selectPage/src/selectPage.mjs.map +1 -1
- package/es/components/selectV2/index.mjs +1 -10
- package/es/components/selectV2/index.mjs.map +1 -1
- package/es/components/selectV2/src/selectV2.mjs +1 -605
- package/es/components/selectV2/src/selectV2.mjs.map +1 -1
- package/es/components/table/images/artwork.png.mjs +1 -4
- package/es/components/table/images/artwork.png.mjs.map +1 -1
- package/es/components/table/images/notImage.png.mjs +1 -4
- package/es/components/table/images/notImage.png.mjs.map +1 -1
- package/es/components/table/index.mjs +1 -31
- package/es/components/table/index.mjs.map +1 -1
- package/es/components/table/src/page.type.mjs +1 -15
- package/es/components/table/src/page.type.mjs.map +1 -1
- package/es/components/table/src/table.mjs +1 -1045
- package/es/components/table/src/table.mjs.map +1 -1
- package/es/components/table/src/table.type.mjs +1 -13
- package/es/components/table/src/table.type.mjs.map +1 -1
- package/es/components/table/src/tableColumn.mjs +1 -603
- package/es/components/table/src/tableColumn.mjs.map +1 -1
- package/es/components/table/src/tableColumnSettingDialog.mjs +1 -429
- package/es/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
- package/es/components/table/src/tablePagination.mjs +1 -55
- package/es/components/table/src/tablePagination.mjs.map +1 -1
- package/es/components/table/src/tableSearchForm.mjs +1 -268
- package/es/components/table/src/tableSearchForm.mjs.map +1 -1
- package/es/components/table/src/tableSearchFormItem.mjs +1 -120
- package/es/components/table/src/tableSearchFormItem.mjs.map +1 -1
- package/es/components/table/src/useTable.mjs +1 -373
- package/es/components/table/src/useTable.mjs.map +1 -1
- package/es/components/table/utils/table.mjs +1 -121
- package/es/components/table/utils/table.mjs.map +1 -1
- package/es/components/tree/index.mjs +1 -11
- package/es/components/tree/index.mjs.map +1 -1
- package/es/components/tree/src/tree.mjs +1 -363
- package/es/components/tree/src/tree.mjs.map +1 -1
- package/es/components/tree/src/tree.props.mjs +1 -70
- package/es/components/tree/src/tree.props.mjs.map +1 -1
- package/es/components/treeSelect/index.mjs +1 -10
- package/es/components/treeSelect/index.mjs.map +1 -1
- package/es/components/treeSelect/src/treeSelect.mjs +1 -491
- package/es/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/es/components/upload/index.mjs +1 -10
- package/es/components/upload/index.mjs.map +1 -1
- package/es/components/upload/src/upload.mjs +1 -139
- package/es/components/upload/src/upload.mjs.map +1 -1
- package/es/components/upload/src/useUpload.mjs +1 -149
- package/es/components/upload/src/useUpload.mjs.map +1 -1
- package/es/components/upload/utils/upload.mjs +1 -118
- package/es/components/upload/utils/upload.mjs.map +1 -1
- package/es/components/uploadImage/index.mjs +1 -10
- package/es/components/uploadImage/index.mjs.map +1 -1
- package/es/components/uploadImage/src/uploadImage.mjs +1 -206
- package/es/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/es/components/uploadImages/index.mjs +1 -7
- package/es/components/uploadImages/index.mjs.map +1 -1
- package/es/components/uploadImages/src/uploadImages.mjs +1 -193
- package/es/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/es/constants/index.mjs +1 -6
- package/es/constants/index.mjs.map +1 -1
- package/es/constants/mime.mjs +1 -61
- package/es/constants/mime.mjs.map +1 -1
- package/es/constants/regex.mjs +1 -78
- package/es/constants/regex.mjs.map +1 -1
- package/es/directive.mjs +1 -10
- package/es/directive.mjs.map +1 -1
- package/es/directives/click-copy/index.mjs +1 -35
- package/es/directives/click-copy/index.mjs.map +1 -1
- package/es/directives/click-debounce/index.mjs +1 -19
- package/es/directives/click-debounce/index.mjs.map +1 -1
- package/es/directives/click-draggable/index.mjs +1 -37
- package/es/directives/click-draggable/index.mjs.map +1 -1
- package/es/directives/click-icon-copy/index.mjs +1 -53
- package/es/directives/click-icon-copy/index.mjs.map +1 -1
- package/es/directives/click-longpress/index.mjs +1 -41
- package/es/directives/click-longpress/index.mjs.map +1 -1
- package/es/directives/click-throttle/index.mjs +1 -30
- package/es/directives/click-throttle/index.mjs.map +1 -1
- package/es/directives/index.mjs +1 -14
- package/es/directives/index.mjs.map +1 -1
- package/es/element-plus.mjs +1 -303
- package/es/element-plus.mjs.map +1 -1
- package/es/hooks/index.mjs +1 -8
- package/es/hooks/index.mjs.map +1 -1
- package/es/hooks/use-loading/index.mjs +1 -33
- package/es/hooks/use-loading/index.mjs.map +1 -1
- package/es/hooks/use-overlay/index.mjs +1 -25
- package/es/hooks/use-overlay/index.mjs.map +1 -1
- package/es/hooks/use-screenFull/index.mjs +1 -44
- package/es/hooks/use-screenFull/index.mjs.map +1 -1
- package/es/index.mjs +1 -137
- package/es/index.mjs.map +1 -1
- package/es/make-installer.mjs +1 -26
- package/es/make-installer.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -4
- package/es/version.mjs.map +1 -1
- package/lib/components/carNumber/src/carNumber.d.ts +5 -5
- package/lib/components/drawer/src/drawer.d.ts +9 -0
- package/lib/components/table/src/table.js +1 -1
- package/lib/components/table/src/table.js.map +1 -1
- package/lib/components/table/src/tablePagination.js +1 -1
- package/lib/components/table/src/tablePagination.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,164 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { formContextKey, formItemContextKey, ElMessage, inputProps, ElPopover, ElButton, ElInput } from "element-plus";
|
|
3
|
-
import { Back } from "@element-plus/icons-vue";
|
|
4
|
-
import "../../../constants/index.mjs";
|
|
5
|
-
import { withDefineType, useProps, useRender } from "@fast-china/utils";
|
|
6
|
-
import { isString, isNull } from "lodash-unified";
|
|
7
|
-
import { CarNumberArea, CarNumberDigit, CarNumberLetter } from "./common.mjs";
|
|
8
|
-
import { RegExps } from "../../../constants/regex.mjs";
|
|
9
|
-
function _isSlot(s) {
|
|
10
|
-
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
11
|
-
}
|
|
12
|
-
const CarNumber = /* @__PURE__ */ defineComponent({
|
|
13
|
-
name: "FaCarNumber",
|
|
14
|
-
props: {
|
|
15
|
-
...inputProps,
|
|
16
|
-
/** @description placeholder */
|
|
17
|
-
placeholder: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: "请选择"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
emits: {
|
|
23
|
-
/** @description v-model 回调 */
|
|
24
|
-
"update:modelValue": (value) => isString(value) || isNull(value),
|
|
25
|
-
/** @description 改变 */
|
|
26
|
-
change: (value) => isString(value) || isNull(value)
|
|
27
|
-
},
|
|
28
|
-
setup(props, {
|
|
29
|
-
attrs,
|
|
30
|
-
emit
|
|
31
|
-
}) {
|
|
32
|
-
const state = reactive({
|
|
33
|
-
value: withDefineType(),
|
|
34
|
-
switchLetter: computed(() => {
|
|
35
|
-
if (state.value?.length >= 1) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}),
|
|
40
|
-
disabledButton: computed(() => {
|
|
41
|
-
if (state.value?.length >= 8) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
const popoverRef = ref();
|
|
48
|
-
const formContext = inject(formContextKey, void 0);
|
|
49
|
-
const formItemContext = inject(formItemContextKey, void 0);
|
|
50
|
-
const handleInputFormatter = (value) => {
|
|
51
|
-
if (value.length === 2) {
|
|
52
|
-
return `${value} ● `;
|
|
53
|
-
} else if (value.length > 2) {
|
|
54
|
-
return `${value.slice(0, 2)} ● ${value.slice(2)}`;
|
|
55
|
-
} else {
|
|
56
|
-
return value;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const handleSelectCarNumber = (value) => {
|
|
60
|
-
state.value ??= "";
|
|
61
|
-
state.value += value;
|
|
62
|
-
};
|
|
63
|
-
const handleBackClick = () => {
|
|
64
|
-
if (state.value?.length === 0) return;
|
|
65
|
-
state.value = state.value.substring(0, state.value.length - 1);
|
|
66
|
-
};
|
|
67
|
-
const handleConfirmClick = () => {
|
|
68
|
-
let success = false;
|
|
69
|
-
if (state.value.length === 7) {
|
|
70
|
-
success = RegExps.CarNumber.test(state.value);
|
|
71
|
-
} else if (state.value.length === 8) {
|
|
72
|
-
success = RegExps.NewEnergyCarNumber.test(state.value);
|
|
73
|
-
}
|
|
74
|
-
if (success) {
|
|
75
|
-
emit("update:modelValue", state.value);
|
|
76
|
-
emit("change", state.value);
|
|
77
|
-
formItemContext?.prop && formContext?.validateField([formItemContext.prop]);
|
|
78
|
-
} else {
|
|
79
|
-
if (formItemContext?.prop && formContext) {
|
|
80
|
-
emit("update:modelValue", state.value);
|
|
81
|
-
emit("change", state.value);
|
|
82
|
-
formContext.validateField([formItemContext.prop]);
|
|
83
|
-
} else {
|
|
84
|
-
ElMessage.error("车牌号格式不正确");
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
popoverRef.value?.hide();
|
|
88
|
-
};
|
|
89
|
-
const handleClearClick = () => {
|
|
90
|
-
state.value = null;
|
|
91
|
-
emit("update:modelValue", null);
|
|
92
|
-
emit("change", null);
|
|
93
|
-
formItemContext?.prop && formContext?.validateField([formItemContext.prop]);
|
|
94
|
-
};
|
|
95
|
-
watch(() => props.modelValue, (newValue) => {
|
|
96
|
-
state.value = newValue.toString();
|
|
97
|
-
}, {
|
|
98
|
-
immediate: true
|
|
99
|
-
});
|
|
100
|
-
const elInputProps = useProps(props, inputProps, ["modelValue", "readonly", "formatter"]);
|
|
101
|
-
useRender(() => createVNode(ElPopover, {
|
|
102
|
-
"ref": popoverRef,
|
|
103
|
-
"width": "auto",
|
|
104
|
-
"popperClass": "fa-car-number__popover",
|
|
105
|
-
"trigger": "click",
|
|
106
|
-
"showArrow": false,
|
|
107
|
-
"showAfter": 0,
|
|
108
|
-
"hideAfter": 0
|
|
109
|
-
}, {
|
|
110
|
-
reference: () => createVNode(ElInput, mergeProps(elInputProps.value, {
|
|
111
|
-
"class": "fa-car-number__input",
|
|
112
|
-
"modelValue": state.value,
|
|
113
|
-
"onUpdate:modelValue": ($event) => state.value = $event,
|
|
114
|
-
"readonly": true,
|
|
115
|
-
"formatter": handleInputFormatter
|
|
116
|
-
}), null),
|
|
117
|
-
default: () => createVNode(Fragment, null, [createVNode("div", {
|
|
118
|
-
"class": ["fa-car-number__popover__area", state.switchLetter ? "fa-car-number__popover__hide" : ""]
|
|
119
|
-
}, [CarNumberArea.map((area) => createVNode(ElButton, {
|
|
120
|
-
"disabled": state.disabledButton,
|
|
121
|
-
"onClick": () => handleSelectCarNumber(area)
|
|
122
|
-
}, _isSlot(area) ? area : {
|
|
123
|
-
default: () => [area]
|
|
124
|
-
}))]), createVNode("div", {
|
|
125
|
-
"class": ["fa-car-number__popover__digit-letter", state.switchLetter ? "" : "fa-car-number__popover__hide"]
|
|
126
|
-
}, [CarNumberDigit.map((digit) => createVNode(ElButton, {
|
|
127
|
-
"disabled": state.disabledButton,
|
|
128
|
-
"onClick": () => handleSelectCarNumber(digit)
|
|
129
|
-
}, _isSlot(digit) ? digit : {
|
|
130
|
-
default: () => [digit]
|
|
131
|
-
})), CarNumberLetter.map((letter) => createVNode(ElButton, {
|
|
132
|
-
"disabled": state.disabledButton,
|
|
133
|
-
"onClick": () => handleSelectCarNumber(letter)
|
|
134
|
-
}, _isSlot(letter) ? letter : {
|
|
135
|
-
default: () => [letter]
|
|
136
|
-
}))]), createVNode("div", {
|
|
137
|
-
"class": "fa-car-number__popover__btn"
|
|
138
|
-
}, [createVNode(ElButton, {
|
|
139
|
-
"class": "fa-car-number__popover__btn__clear",
|
|
140
|
-
"disabled": state.value === null || state.value.length === 0,
|
|
141
|
-
"onClick": handleClearClick
|
|
142
|
-
}, {
|
|
143
|
-
default: () => [createTextVNode("清除")]
|
|
144
|
-
}), createVNode(ElButton, {
|
|
145
|
-
"class": "fa-car-number__popover__btn__back",
|
|
146
|
-
"type": "danger",
|
|
147
|
-
"icon": Back,
|
|
148
|
-
"disabled": state.value === null || state.value.length === 0,
|
|
149
|
-
"onClick": handleBackClick
|
|
150
|
-
}, null), createVNode(ElButton, {
|
|
151
|
-
"class": "fa-car-number__popover__btn__confirm",
|
|
152
|
-
"type": "primary",
|
|
153
|
-
"disabled": state.value === null || state.value.length < 7,
|
|
154
|
-
"onClick": handleConfirmClick
|
|
155
|
-
}, {
|
|
156
|
-
default: () => [createTextVNode("确认")]
|
|
157
|
-
})])])
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
export {
|
|
162
|
-
CarNumber as default
|
|
163
|
-
};
|
|
1
|
+
import{isVNode as e,defineComponent as l,reactive as a,computed as t,ref as r,inject as o,watch as u,createVNode as n,Fragment as i,createTextVNode as d,mergeProps as p}from"vue";import{formContextKey as s,formItemContextKey as m,ElMessage as c,inputProps as v,ElPopover as _,ElButton as f,ElInput as b}from"element-plus";import{Back as h}from"@element-plus/icons-vue";import"../../../constants/index.mjs";import{withDefineType as g,useProps as C,useRender as y}from"@fast-china/utils";import{isString as k,isNull as w}from"lodash-unified";import{CarNumberArea as V,CarNumberDigit as j,CarNumberLetter as B}from"./common.mjs";import{RegExps as F}from"../../../constants/regex.mjs";function N(l){return"function"==typeof l||"[object Object]"===Object.prototype.toString.call(l)&&!e(l)}const x=/* @__PURE__ */l({name:"FaCarNumber",props:{...v,placeholder:{type:String,default:"请选择"}},emits:{"update:modelValue":e=>k(e)||w(e),change:e=>k(e)||w(e)},setup(e,{attrs:l,emit:k}){const w=a({value:g(),switchLetter:t(()=>w.value?.length>=1),disabledButton:t(()=>w.value?.length>=8)}),x=r(),A=o(s,void 0),L=o(m,void 0),S=e=>2===e.length?`${e} ● `:e.length>2?`${e.slice(0,2)} ● ${e.slice(2)}`:e,$=e=>{w.value??="",w.value+=e},O=()=>{0!==w.value?.length&&(w.value=w.value.substring(0,w.value.length-1))},E=()=>{let e=!1;7===w.value.length?e=F.CarNumber.test(w.value):8===w.value.length&&(e=F.NewEnergyCarNumber.test(w.value)),e?(k("update:modelValue",w.value),k("change",w.value),L?.prop&&A?.validateField([L.prop])):L?.prop&&A?(k("update:modelValue",w.value),k("change",w.value),A.validateField([L.prop])):c.error("车牌号格式不正确"),x.value?.hide()},U=()=>{w.value=null,k("update:modelValue",null),k("change",null),L?.prop&&A?.validateField([L.prop])};u(()=>e.modelValue,e=>{w.value=e.toString()},{immediate:!0});const q=C(e,v,["modelValue","readonly","formatter"]);y(()=>n(_,{ref:x,width:"auto",popperClass:"fa-car-number__popover",trigger:"click",showArrow:!1,showAfter:0,hideAfter:0},{reference:()=>n(b,p(q.value,{class:"fa-car-number__input",modelValue:w.value,"onUpdate:modelValue":e=>w.value=e,readonly:!0,formatter:S}),null),default:()=>n(i,null,[n("div",{class:["fa-car-number__popover__area",w.switchLetter?"fa-car-number__popover__hide":""]},[V.map(e=>n(f,{disabled:w.disabledButton,onClick:()=>$(e)},N(e)?e:{default:()=>[e]}))]),n("div",{class:["fa-car-number__popover__digit-letter",w.switchLetter?"":"fa-car-number__popover__hide"]},[j.map(e=>n(f,{disabled:w.disabledButton,onClick:()=>$(e)},N(e)?e:{default:()=>[e]})),B.map(e=>n(f,{disabled:w.disabledButton,onClick:()=>$(e)},N(e)?e:{default:()=>[e]}))]),n("div",{class:"fa-car-number__popover__btn"},[n(f,{class:"fa-car-number__popover__btn__clear",disabled:null===w.value||0===w.value.length,onClick:U},{default:()=>[d("清除")]}),n(f,{class:"fa-car-number__popover__btn__back",type:"danger",icon:h,disabled:null===w.value||0===w.value.length,onClick:O},null),n(f,{class:"fa-car-number__popover__btn__confirm",type:"primary",disabled:null===w.value||w.value.length<7,onClick:E},{default:()=>[d("确认")]})])])}))}});export{x as default};
|
|
164
2
|
//# sourceMappingURL=carNumber.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carNumber.mjs","sources":["../../../../../packages/components/carNumber/src/carNumber.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, reactive, ref, watch } from \"vue\";\nimport { ElButton, ElInput, ElMessage, ElPopover, formContextKey, formItemContextKey, inputProps } from \"element-plus\";\nimport { Back } from \"@element-plus/icons-vue\";\nimport { RegExps } from \"@fast-element-plus/constants\";\nimport { useProps, useRender, withDefineType } from \"@fast-china/utils\";\nimport { isNull, isString } from \"lodash-unified\";\nimport { CarNumberArea, CarNumberDigit, CarNumberLetter } from \"./common\";\nimport type { PopoverInstance } from \"element-plus\";\n\nexport default defineComponent({\n\tname: \"FaCarNumber\",\n\tprops: {\n\t\t...inputProps,\n\t\t/** @description placeholder */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: \"请选择\",\n\t\t},\n\t},\n\temits: {\n\t\t/** @description v-model 回调 */\n\t\t\"update:modelValue\": (value: string) => isString(value) || isNull(value),\n\t\t/** @description 改变 */\n\t\tchange: (value: string) => isString(value) || isNull(value),\n\t},\n\tsetup(props, { attrs, emit }) {\n\t\tconst state = reactive({\n\t\t\tvalue: withDefineType<string>(),\n\t\t\tswitchLetter: computed(() => {\n\t\t\t\tif (state.value?.length >= 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t\tdisabledButton: computed(() => {\n\t\t\t\tif (state.value?.length >= 8) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t});\n\n\t\tconst popoverRef = ref<PopoverInstance>();\n\t\t// 获取 el-form 组件上下文\n\t\tconst formContext = inject(formContextKey, undefined);\n\t\t// 获取 el-form-item 组件上下文\n\t\tconst formItemContext = inject(formItemContextKey, undefined);\n\n\t\tconst handleInputFormatter = (value: string): string => {\n\t\t\tif (value.length === 2) {\n\t\t\t\treturn `${value} ● `;\n\t\t\t} else if (value.length > 2) {\n\t\t\t\treturn `${value.slice(0, 2)} ● ${value.slice(2)}`;\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t};\n\n\t\tconst handleSelectCarNumber = (value: string): void => {\n\t\t\tstate.value ??= \"\";\n\t\t\tstate.value += value;\n\t\t};\n\n\t\tconst handleBackClick = (): void => {\n\t\t\tif (state.value?.length === 0) return;\n\t\t\tstate.value = state.value.substring(0, state.value.length - 1);\n\t\t};\n\n\t\tconst handleConfirmClick = (): void => {\n\t\t\tlet success = false;\n\t\t\tif (state.value.length === 7) {\n\t\t\t\tsuccess = RegExps.CarNumber.test(state.value);\n\t\t\t} else if (state.value.length === 8) {\n\t\t\t\tsuccess = RegExps.NewEnergyCarNumber.test(state.value);\n\t\t\t}\n\t\t\tif (success) {\n\t\t\t\temit(\"update:modelValue\", state.value);\n\t\t\t\temit(\"change\", state.value);\n\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\tformItemContext?.prop && formContext?.validateField([formItemContext.prop]);\n\t\t\t} else {\n\t\t\t\tif (formItemContext?.prop && formContext) {\n\t\t\t\t\temit(\"update:modelValue\", state.value);\n\t\t\t\t\temit(\"change\", state.value);\n\t\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\t\tformContext.validateField([formItemContext.prop]);\n\t\t\t\t} else {\n\t\t\t\t\tElMessage.error(\"车牌号格式不正确\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tpopoverRef.value?.hide();\n\t\t};\n\n\t\tconst handleClearClick = (): void => {\n\t\t\tstate.value = null;\n\t\t\temit(\"update:modelValue\", null);\n\t\t\temit(\"change\", null);\n\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\tformItemContext?.prop && formContext?.validateField([formItemContext.prop]);\n\t\t};\n\n\t\twatch(\n\t\t\t() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tstate.value = newValue.toString();\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tconst elInputProps = useProps(props, inputProps, [\"modelValue\", \"readonly\", \"formatter\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElPopover\n\t\t\t\tref={popoverRef}\n\t\t\t\twidth=\"auto\"\n\t\t\t\tpopperClass=\"fa-car-number__popover\"\n\t\t\t\ttrigger=\"click\"\n\t\t\t\tshowArrow={false}\n\t\t\t\tshowAfter={0}\n\t\t\t\thideAfter={0}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\treference: () => (\n\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t{...elInputProps.value}\n\t\t\t\t\t\t\tclass=\"fa-car-number__input\"\n\t\t\t\t\t\t\tvModel={state.value}\n\t\t\t\t\t\t\treadonly\n\t\t\t\t\t\t\tformatter={handleInputFormatter}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__area\", state.switchLetter ? \"fa-car-number__popover__hide\" : \"\"]}>\n\t\t\t\t\t\t\t\t{CarNumberArea.map((area) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(area)}>\n\t\t\t\t\t\t\t\t\t\t{area}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__digit-letter\", state.switchLetter ? \"\" : \"fa-car-number__popover__hide\"]}>\n\t\t\t\t\t\t\t\t{CarNumberDigit.map((digit) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(digit)}>\n\t\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t{CarNumberLetter.map((letter) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(letter)}>\n\t\t\t\t\t\t\t\t\t\t{letter}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"fa-car-number__popover__btn\">\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__clear\"\n\t\t\t\t\t\t\t\t\tdisabled={state.value === null || state.value.length === 0}\n\t\t\t\t\t\t\t\t\tonClick={handleClearClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t清除\n\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__back\"\n\t\t\t\t\t\t\t\t\ttype=\"danger\"\n\t\t\t\t\t\t\t\t\ticon={Back}\n\t\t\t\t\t\t\t\t\tdisabled={state.value === null || state.value.length === 0}\n\t\t\t\t\t\t\t\t\tonClick={handleBackClick}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__confirm\"\n\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\tdisabled={state.value === null || state.value.length < 7}\n\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t确认\n\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElPopover>\n\t\t));\n\t},\n});\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","name","props","inputProps","placeholder","type","String","default","emits","value","isString","isNull","change","setup","attrs","emit","state","reactive","withDefineType","switchLetter","computed","length","disabledButton","popoverRef","ref","formContext","inject","formContextKey","undefined","formItemContext","formItemContextKey","handleInputFormatter","slice","handleSelectCarNumber","handleBackClick","substring","handleConfirmClick","success","RegExps","CarNumber","test","NewEnergyCarNumber","prop","validateField","ElMessage","error","hide","handleClearClick","watch","modelValue","newValue","immediate","elInputProps","useProps","useRender","_createVNode","ElPopover","reference","ElInput","_mergeProps","$event","_Fragment","CarNumberArea","map","area","ElButton","onClick","CarNumberDigit","digit","CarNumberLetter","letter","_createTextVNode","Back"],"mappings":";;;;;;;;AAM0E,SAAAA,QAAAC,GAAA;AAAA,SAAA,OAAAA,MAAA,cAAAC,OAAAC,UAAAC,SAAAC,KAAAJ,CAAA,MAAA,qBAAA,CAAAK,QAAAL,CAAA;AAAA;AAG1E,MAAA,4CAA+B;AAAA,EAC9BM,MAAM;AAAA,EACNC,OAAO;AAAA,IACN,GAAGC;AAAAA;AAAAA,IAEHC,aAAa;AAAA,MACZC,MAAMC;AAAAA,MACNC,SAAS;AAAA,IACV;AAAA;EAEDC,OAAO;AAAA;AAAA,IAEN,qBAAsBC,WAAkBC,SAASD,KAAK,KAAKE,OAAOF,KAAK;AAAA;AAAA,IAEvEG,QAASH,WAAkBC,SAASD,KAAK,KAAKE,OAAOF,KAAK;AAAA;EAE3DI,MAAMX,OAAO;AAAA,IAAEY;AAAAA,IAAOC;AAAAA,EAAK,GAAG;AAC7B,UAAMC,QAAQC,SAAS;AAAA,MACtBR,OAAOS,eAAc;AAAA,MACrBC,cAAcC,SAAS,MAAM;AAC5B,YAAIJ,MAAMP,OAAOY,UAAU,GAAG;AAC7B,iBAAO;AAAA,QACR;AACA,eAAO;AAAA,MACR,CAAC;AAAA,MACDC,gBAAgBF,SAAS,MAAM;AAC9B,YAAIJ,MAAMP,OAAOY,UAAU,GAAG;AAC7B,iBAAO;AAAA,QACR;AACA,eAAO;AAAA,MACR,CAAC;AAAA,IACF,CAAC;AAED,UAAME,aAAaC,IAAG;AAEtB,UAAMC,cAAcC,OAAOC,gBAAgBC,MAAS;AAEpD,UAAMC,kBAAkBH,OAAOI,oBAAoBF,MAAS;AAE5D,UAAMG,uBAAwBtB,WAA0B;AACvD,UAAIA,MAAMY,WAAW,GAAG;AACvB,eAAO,GAAGZ,KAAK;AAAA,MAChB,WAAWA,MAAMY,SAAS,GAAG;AAC5B,eAAO,GAAGZ,MAAMuB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,IAALA,QAAK;AAAA,QAAA7D,SAAAA,MAAA,CAAL6D,KAAK;AAAA,OAAA,CAEP,GACAC,gBAAgBN,IAAKO,YAAMf,YAAAU,UAAA;AAAA,QAAA,YACPjD,MAAMM;AAAAA,QAAc,WAAW4C,MAAMjC,sBAAsBqC,MAAM;AAAA,MAAC,GAAA5E,QACpF4E,MAAM,IAANA,SAAM;AAAA,QAAA/D,SAAAA,MAAA,CAAN+D,MAAM;AAAA,OAAA,CAER,CAAC,IAAAf,YAAA,OAAA;AAAA,QAAA,SAAA;AAAA,SAAA,CAAAA,YAAAU,UAAA;AAAA,QAAA,SAAA;AAAA,QAAA,YAKSjD,MAAMP,UAAU,QAAQO,MAAMP,MAAMY,WAAW;AAAA,QAAC,WACjD0B;AAAAA,MAAgB,GAAA;AAAA,QAAAxC,SAAAA,MAAA,CAAAgE,gBAAA,IAAA,CAAA;AAAA,OAAA,GAAAhB,YAAAU,UAAA;AAAA,QAAA,SAAA;AAAA,QAAA,QAAA;AAAA,QAAA,QAOnBO;AAAAA,QAAI,YACAxD,MAAMP,UAAU,QAAQO,MAAMP,MAAMY,WAAW;AAAA,QAAC,WACjDa;AAAAA,SAAe,IAAA,GAAAqB,YAAAU,UAAA;AAAA,QAAA,SAAA;AAAA,QAAA,QAAA;AAAA,QAAA,YAKdjD,MAAMP,UAAU,QAAQO,MAAMP,MAAMY,SAAS;AAAA,QAAC,WAC/Ce;AAAAA,MAAkB,GAAA;AAAA,QAAA7B,SAAAA,MAAA,CAAAgE,gBAAA,IAAA,CAAA;AAAA,MAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,IAM9B,CAAA,CAGH;AAAA,EACF;AACD,CAAC;"}
|
|
1
|
+
{"version":3,"file":"carNumber.mjs","sources":["../../../../../packages/components/carNumber/src/carNumber.tsx"],"sourcesContent":["import { Fragment, computed, defineComponent, inject, reactive, ref, watch } from \"vue\";\nimport { ElButton, ElInput, ElMessage, ElPopover, formContextKey, formItemContextKey, inputProps } from \"element-plus\";\nimport { Back } from \"@element-plus/icons-vue\";\nimport { RegExps } from \"@fast-element-plus/constants\";\nimport { useProps, useRender, withDefineType } from \"@fast-china/utils\";\nimport { isNull, isString } from \"lodash-unified\";\nimport { CarNumberArea, CarNumberDigit, CarNumberLetter } from \"./common\";\nimport type { PopoverInstance } from \"element-plus\";\n\nexport default defineComponent({\n\tname: \"FaCarNumber\",\n\tprops: {\n\t\t...inputProps,\n\t\t/** @description placeholder */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: \"请选择\",\n\t\t},\n\t},\n\temits: {\n\t\t/** @description v-model 回调 */\n\t\t\"update:modelValue\": (value: string) => isString(value) || isNull(value),\n\t\t/** @description 改变 */\n\t\tchange: (value: string) => isString(value) || isNull(value),\n\t},\n\tsetup(props, { attrs, emit }) {\n\t\tconst state = reactive({\n\t\t\tvalue: withDefineType<string>(),\n\t\t\tswitchLetter: computed(() => {\n\t\t\t\tif (state.value?.length >= 1) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t\tdisabledButton: computed(() => {\n\t\t\t\tif (state.value?.length >= 8) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}),\n\t\t});\n\n\t\tconst popoverRef = ref<PopoverInstance>();\n\t\t// 获取 el-form 组件上下文\n\t\tconst formContext = inject(formContextKey, undefined);\n\t\t// 获取 el-form-item 组件上下文\n\t\tconst formItemContext = inject(formItemContextKey, undefined);\n\n\t\tconst handleInputFormatter = (value: string): string => {\n\t\t\tif (value.length === 2) {\n\t\t\t\treturn `${value} ● `;\n\t\t\t} else if (value.length > 2) {\n\t\t\t\treturn `${value.slice(0, 2)} ● ${value.slice(2)}`;\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t};\n\n\t\tconst handleSelectCarNumber = (value: string): void => {\n\t\t\tstate.value ??= \"\";\n\t\t\tstate.value += value;\n\t\t};\n\n\t\tconst handleBackClick = (): void => {\n\t\t\tif (state.value?.length === 0) return;\n\t\t\tstate.value = state.value.substring(0, state.value.length - 1);\n\t\t};\n\n\t\tconst handleConfirmClick = (): void => {\n\t\t\tlet success = false;\n\t\t\tif (state.value.length === 7) {\n\t\t\t\tsuccess = RegExps.CarNumber.test(state.value);\n\t\t\t} else if (state.value.length === 8) {\n\t\t\t\tsuccess = RegExps.NewEnergyCarNumber.test(state.value);\n\t\t\t}\n\t\t\tif (success) {\n\t\t\t\temit(\"update:modelValue\", state.value);\n\t\t\t\temit(\"change\", state.value);\n\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\tformItemContext?.prop && formContext?.validateField([formItemContext.prop]);\n\t\t\t} else {\n\t\t\t\tif (formItemContext?.prop && formContext) {\n\t\t\t\t\temit(\"update:modelValue\", state.value);\n\t\t\t\t\temit(\"change\", state.value);\n\t\t\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\t\t\tformContext.validateField([formItemContext.prop]);\n\t\t\t\t} else {\n\t\t\t\t\tElMessage.error(\"车牌号格式不正确\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tpopoverRef.value?.hide();\n\t\t};\n\n\t\tconst handleClearClick = (): void => {\n\t\t\tstate.value = null;\n\t\t\temit(\"update:modelValue\", null);\n\t\t\temit(\"change\", null);\n\t\t\t// 调用 el-form 内部的校验方法(可自动校验)\n\t\t\tformItemContext?.prop && formContext?.validateField([formItemContext.prop]);\n\t\t};\n\n\t\twatch(\n\t\t\t() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tstate.value = newValue.toString();\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tconst elInputProps = useProps(props, inputProps, [\"modelValue\", \"readonly\", \"formatter\"]);\n\n\t\tuseRender(() => (\n\t\t\t<ElPopover\n\t\t\t\tref={popoverRef}\n\t\t\t\twidth=\"auto\"\n\t\t\t\tpopperClass=\"fa-car-number__popover\"\n\t\t\t\ttrigger=\"click\"\n\t\t\t\tshowArrow={false}\n\t\t\t\tshowAfter={0}\n\t\t\t\thideAfter={0}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\treference: () => (\n\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t{...elInputProps.value}\n\t\t\t\t\t\t\tclass=\"fa-car-number__input\"\n\t\t\t\t\t\t\tvModel={state.value}\n\t\t\t\t\t\t\treadonly\n\t\t\t\t\t\t\tformatter={handleInputFormatter}\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tdefault: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__area\", state.switchLetter ? \"fa-car-number__popover__hide\" : \"\"]}>\n\t\t\t\t\t\t\t\t{CarNumberArea.map((area) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(area)}>\n\t\t\t\t\t\t\t\t\t\t{area}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class={[\"fa-car-number__popover__digit-letter\", state.switchLetter ? \"\" : \"fa-car-number__popover__hide\"]}>\n\t\t\t\t\t\t\t\t{CarNumberDigit.map((digit) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(digit)}>\n\t\t\t\t\t\t\t\t\t\t{digit}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t{CarNumberLetter.map((letter) => (\n\t\t\t\t\t\t\t\t\t<ElButton disabled={state.disabledButton} onClick={() => handleSelectCarNumber(letter)}>\n\t\t\t\t\t\t\t\t\t\t{letter}\n\t\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"fa-car-number__popover__btn\">\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__clear\"\n\t\t\t\t\t\t\t\t\tdisabled={state.value === null || state.value.length === 0}\n\t\t\t\t\t\t\t\t\tonClick={handleClearClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t清除\n\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__back\"\n\t\t\t\t\t\t\t\t\ttype=\"danger\"\n\t\t\t\t\t\t\t\t\ticon={Back}\n\t\t\t\t\t\t\t\t\tdisabled={state.value === null || state.value.length === 0}\n\t\t\t\t\t\t\t\t\tonClick={handleBackClick}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\tclass=\"fa-car-number__popover__btn__confirm\"\n\t\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\t\tdisabled={state.value === null || state.value.length < 7}\n\t\t\t\t\t\t\t\t\tonClick={handleConfirmClick}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t确认\n\t\t\t\t\t\t\t\t</ElButton>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t}}\n\t\t\t</ElPopover>\n\t\t));\n\t},\n});\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","CarNumber","name","props","inputProps","placeholder","type","String","default","emits","value","isString","isNull","change","setup","attrs","emit","state","reactive","withDefineType","switchLetter","computed","length","disabledButton","popoverRef","ref","formContext","inject","formContextKey","undefined","formItemContext","formItemContextKey","handleInputFormatter","slice","handleSelectCarNumber","handleBackClick","substring","handleConfirmClick","success","RegExps","test","NewEnergyCarNumber","prop","validateField","ElMessage","error","hide","handleClearClick","watch","modelValue","newValue","immediate","elInputProps","useProps","useRender","_createVNode","ElPopover","width","popperClass","trigger","showArrow","showAfter","hideAfter","reference","ElInput","_mergeProps","class","$event","readonly","formatter","_Fragment","CarNumberArea","map","area","ElButton","disabled","onClick","CarNumberDigit","digit","CarNumberLetter","letter","_createTextVNode","icon","Back"],"mappings":"yqBAM0E,SAAAA,EAAAC,GAAA,MAAA,mBAAAA,GAAA,oBAAAC,OAAAC,UAAAC,SAAAC,KAAAJ,KAAAK,EAAAL,EAAA,CAG1E,MAAAM,mBAA+B,CAC9BC,KAAM,cACNC,MAAO,IACHC,EAEHC,YAAa,CACZC,KAAMC,OACNC,QAAS,QAGXC,MAAO,CAEN,oBAAsBC,GAAkBC,EAASD,IAAUE,EAAOF,GAElEG,OAASH,GAAkBC,EAASD,IAAUE,EAAOF,IAEtDI,KAAAA,CAAMX,GAAOY,MAAEA,EAAAA,KAAOC,IACrB,MAAMC,EAAQC,EAAS,CACtBR,MAAOS,IACPC,aAAcC,EAAS,IAClBJ,EAAMP,OAAOY,QAAU,GAK5BC,eAAgBF,EAAS,IACpBJ,EAAMP,OAAOY,QAAU,KAOvBE,EAAaC,IAEbC,EAAcC,EAAOC,OAAgBC,GAErCC,EAAkBH,EAAOI,OAAoBF,GAE7CG,EAAwBtB,GACR,IAAjBA,EAAMY,OACF,GAAGZ,OACAA,EAAMY,OAAS,EAClB,GAAGZ,EAAMuB,MAAM,EAAG,QAAQvB,EAAMuB,MAAM,KAEtCvB,EAIHwB,EAAyBxB,IAC9BO,EAAMP,QAAU,GAChBO,EAAMP,OAASA,GAGVyB,EAAkBA,KACK,IAAxBlB,EAAMP,OAAOY,SACjBL,EAAMP,MAAQO,EAAMP,MAAM0B,UAAU,EAAGnB,EAAMP,MAAMY,OAAS,KAGvDe,EAAqBA,KAC1B,IAAIC,GAAU,EACa,IAAvBrB,EAAMP,MAAMY,OACfgB,EAAUC,EAAQtC,UAAUuC,KAAKvB,EAAMP,OACN,IAAvBO,EAAMP,MAAMY,SACtBgB,EAAUC,EAAQE,mBAAmBD,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",
|
|
20
|
-
"粤",
|
|
21
|
-
"桂",
|
|
22
|
-
"琼",
|
|
23
|
-
"渝",
|
|
24
|
-
"川",
|
|
25
|
-
"贵",
|
|
26
|
-
"云",
|
|
27
|
-
"藏",
|
|
28
|
-
"陕",
|
|
29
|
-
"甘",
|
|
30
|
-
"青",
|
|
31
|
-
"宁",
|
|
32
|
-
"新",
|
|
33
|
-
"军",
|
|
34
|
-
"使",
|
|
35
|
-
"领"
|
|
36
|
-
];
|
|
37
|
-
const CarNumberLetter = [
|
|
38
|
-
"Q",
|
|
39
|
-
"W",
|
|
40
|
-
"E",
|
|
41
|
-
"R",
|
|
42
|
-
"T",
|
|
43
|
-
"Y",
|
|
44
|
-
"U",
|
|
45
|
-
"O",
|
|
46
|
-
"P",
|
|
47
|
-
"挂",
|
|
48
|
-
"A",
|
|
49
|
-
"S",
|
|
50
|
-
"D",
|
|
51
|
-
"F",
|
|
52
|
-
"G",
|
|
53
|
-
"H",
|
|
54
|
-
"J",
|
|
55
|
-
"K",
|
|
56
|
-
"L",
|
|
57
|
-
"学",
|
|
58
|
-
"Z",
|
|
59
|
-
"X",
|
|
60
|
-
"C",
|
|
61
|
-
"V",
|
|
62
|
-
"B",
|
|
63
|
-
"N",
|
|
64
|
-
"M",
|
|
65
|
-
"警",
|
|
66
|
-
"港",
|
|
67
|
-
"澳"
|
|
68
|
-
];
|
|
69
|
-
const CarNumberDigit = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
|
|
70
|
-
export {
|
|
71
|
-
CarNumberArea,
|
|
72
|
-
CarNumberDigit,
|
|
73
|
-
CarNumberLetter
|
|
74
|
-
};
|
|
1
|
+
const o=["京","津","冀","晋","蒙","辽","吉","黑","沪","苏","浙","皖","闽","赣","鲁","豫","鄂","湘","粤","桂","琼","渝","川","贵","云","藏","陕","甘","青","宁","新","军","使","领"],t=["Q","W","E","R","T","Y","U","O","P","挂","A","S","D","F","G","H","J","K","L","学","Z","X","C","V","B","N","M","警","港","澳"],c=["1","2","3","4","5","6","7","8","9","0"];export{o as CarNumberArea,c as CarNumberDigit,t as CarNumberLetter};
|
|
75
2
|
//# sourceMappingURL=common.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.mjs","sources":["../../../../../packages/components/carNumber/src/common.ts"],"sourcesContent":["/**\n * 车牌号地区\n */\nexport const CarNumberArea: Readonly<string[]> = [\n\t\"京\",\n\t\"津\",\n\t\"冀\",\n\t\"晋\",\n\t\"蒙\",\n\t\"辽\",\n\t\"吉\",\n\t\"黑\",\n\t\"沪\",\n\t\"苏\",\n\t\"浙\",\n\t\"皖\",\n\t\"闽\",\n\t\"赣\",\n\t\"鲁\",\n\t\"豫\",\n\t\"鄂\",\n\t\"湘\",\n\t\"粤\",\n\t\"桂\",\n\t\"琼\",\n\t\"渝\",\n\t\"川\",\n\t\"贵\",\n\t\"云\",\n\t\"藏\",\n\t\"陕\",\n\t\"甘\",\n\t\"青\",\n\t\"宁\",\n\t\"新\",\n\t\"军\",\n\t\"使\",\n\t\"领\",\n];\n\n/**\n * 车牌号字母\n */\nexport const CarNumberLetter: Readonly<string[]> = [\n\t\"Q\",\n\t\"W\",\n\t\"E\",\n\t\"R\",\n\t\"T\",\n\t\"Y\",\n\t\"U\",\n\t\"O\",\n\t\"P\",\n\t\"挂\",\n\t\"A\",\n\t\"S\",\n\t\"D\",\n\t\"F\",\n\t\"G\",\n\t\"H\",\n\t\"J\",\n\t\"K\",\n\t\"L\",\n\t\"学\",\n\t\"Z\",\n\t\"X\",\n\t\"C\",\n\t\"V\",\n\t\"B\",\n\t\"N\",\n\t\"M\",\n\t\"警\",\n\t\"港\",\n\t\"澳\",\n];\n\n/**\n * 车牌号数字\n */\nexport const CarNumberDigit: Readonly<string[]> = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\"];\n\n/**\n * 特殊车牌号\n */\n// export const CarNumberSpecial: Readonly<string[]> = [\"挂\", \"学\", \"警\", \"港\", \"澳\"];\n"],"names":[],"mappings":"AAGO,
|
|
1
|
+
{"version":3,"file":"common.mjs","sources":["../../../../../packages/components/carNumber/src/common.ts"],"sourcesContent":["/**\n * 车牌号地区\n */\nexport const CarNumberArea: Readonly<string[]> = [\n\t\"京\",\n\t\"津\",\n\t\"冀\",\n\t\"晋\",\n\t\"蒙\",\n\t\"辽\",\n\t\"吉\",\n\t\"黑\",\n\t\"沪\",\n\t\"苏\",\n\t\"浙\",\n\t\"皖\",\n\t\"闽\",\n\t\"赣\",\n\t\"鲁\",\n\t\"豫\",\n\t\"鄂\",\n\t\"湘\",\n\t\"粤\",\n\t\"桂\",\n\t\"琼\",\n\t\"渝\",\n\t\"川\",\n\t\"贵\",\n\t\"云\",\n\t\"藏\",\n\t\"陕\",\n\t\"甘\",\n\t\"青\",\n\t\"宁\",\n\t\"新\",\n\t\"军\",\n\t\"使\",\n\t\"领\",\n];\n\n/**\n * 车牌号字母\n */\nexport const CarNumberLetter: Readonly<string[]> = [\n\t\"Q\",\n\t\"W\",\n\t\"E\",\n\t\"R\",\n\t\"T\",\n\t\"Y\",\n\t\"U\",\n\t\"O\",\n\t\"P\",\n\t\"挂\",\n\t\"A\",\n\t\"S\",\n\t\"D\",\n\t\"F\",\n\t\"G\",\n\t\"H\",\n\t\"J\",\n\t\"K\",\n\t\"L\",\n\t\"学\",\n\t\"Z\",\n\t\"X\",\n\t\"C\",\n\t\"V\",\n\t\"B\",\n\t\"N\",\n\t\"M\",\n\t\"警\",\n\t\"港\",\n\t\"澳\",\n];\n\n/**\n * 车牌号数字\n */\nexport const CarNumberDigit: Readonly<string[]> = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"0\"];\n\n/**\n * 特殊车牌号\n */\n// export const CarNumberSpecial: Readonly<string[]> = [\"挂\", \"学\", \"警\", \"港\", \"澳\"];\n"],"names":["CarNumberArea","CarNumberLetter","CarNumberDigit"],"mappings":"AAGO,MAAMA,EAAoC,CAChD,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KAMYC,EAAsC,CAClD,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KAMYC,EAAqC,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK"}
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import ContextMenu from "./src/contextMenu.mjs";
|
|
3
|
-
import "./src/contextMenu.type.mjs";
|
|
4
|
-
const FaContextMenu = withInstall(ContextMenu);
|
|
5
|
-
export {
|
|
6
|
-
FaContextMenu,
|
|
7
|
-
FaContextMenu as default
|
|
8
|
-
};
|
|
1
|
+
import{withInstall as t}from"@fast-china/utils";import o from"./src/contextMenu.mjs";import"./src/contextMenu.type.mjs";const r=t(o);export{r as FaContextMenu,r as default};
|
|
9
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../packages/components/contextMenu/index.ts"],"sourcesContent":["import { withInstall } from \"@fast-china/utils\";\nimport ContextMenu from \"./src/contextMenu\";\n\nexport const FaContextMenu = withInstall(ContextMenu);\nexport default FaContextMenu;\n\nexport * from \"./src/contextMenu.type\";\n\nexport type FaContextMenuInstance = InstanceType<typeof ContextMenu>;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../packages/components/contextMenu/index.ts"],"sourcesContent":["import { withInstall } from \"@fast-china/utils\";\nimport ContextMenu from \"./src/contextMenu\";\n\nexport const FaContextMenu = withInstall(ContextMenu);\nexport default FaContextMenu;\n\nexport * from \"./src/contextMenu.type\";\n\nexport type FaContextMenuInstance = InstanceType<typeof ContextMenu>;\n"],"names":["FaContextMenu","withInstall","ContextMenu"],"mappings":"wHAGO,MAAMA,EAAgBC,EAAYC"}
|
|
@@ -1,85 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useGlobalSize } from "element-plus";
|
|
3
|
-
import { FaIcon } from "../../icon/index.mjs";
|
|
4
|
-
import { useRender, useExpose, definePropType } from "@fast-china/utils";
|
|
5
|
-
import { useEventListener } from "@vueuse/core";
|
|
6
|
-
import { isObject } from "lodash-unified";
|
|
7
|
-
const ContextMenu = /* @__PURE__ */ defineComponent({
|
|
8
|
-
name: "FaContextMenu",
|
|
9
|
-
props: {
|
|
10
|
-
/** @description 数据 */
|
|
11
|
-
data: {
|
|
12
|
-
type: definePropType(Array),
|
|
13
|
-
default: () => []
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
emits: {
|
|
17
|
-
/** @description 点击事件 */
|
|
18
|
-
click: (event, data) => event instanceof MouseEvent && isObject(data)
|
|
19
|
-
},
|
|
20
|
-
setup(props, {
|
|
21
|
-
emit,
|
|
22
|
-
expose
|
|
23
|
-
}) {
|
|
24
|
-
const _globalSize = useGlobalSize();
|
|
25
|
-
const state = reactive({
|
|
26
|
-
visible: false,
|
|
27
|
-
axis: {
|
|
28
|
-
x: 0,
|
|
29
|
-
y: 0
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const handleClick = (event, data) => {
|
|
33
|
-
if (data?.disabled) return;
|
|
34
|
-
data?.click && data.click(event, data);
|
|
35
|
-
emit("click", event, data);
|
|
36
|
-
};
|
|
37
|
-
const open = (axis = {
|
|
38
|
-
x: 0,
|
|
39
|
-
y: 0
|
|
40
|
-
}) => {
|
|
41
|
-
state.axis = axis;
|
|
42
|
-
state.visible = true;
|
|
43
|
-
};
|
|
44
|
-
const close = () => {
|
|
45
|
-
state.visible = false;
|
|
46
|
-
};
|
|
47
|
-
onMounted(() => {
|
|
48
|
-
useEventListener(document, "click", close);
|
|
49
|
-
});
|
|
50
|
-
useRender(() => createVNode(Transition, {
|
|
51
|
-
"name": "el-zoom-in-top"
|
|
52
|
-
}, {
|
|
53
|
-
default: () => [withDirectives(createVNode("div", {
|
|
54
|
-
"class": ["fa-context-menu", `fa-context-menu-${_globalSize.value}`, "el-popper el-dropdown__popper"],
|
|
55
|
-
"style": {
|
|
56
|
-
top: `${state.axis.y + 5}px`,
|
|
57
|
-
left: `${state.axis.x + 14}px`
|
|
58
|
-
},
|
|
59
|
-
"key": Math.random()
|
|
60
|
-
}, [createVNode("ul", {
|
|
61
|
-
"class": "el-dropdown-menu"
|
|
62
|
-
}, [props.data.filter((f) => !f.hide).map((item) => createVNode("li", {
|
|
63
|
-
"class": ["el-dropdown-menu__item", item?.disabled === true ? "is-disabled" : ""],
|
|
64
|
-
"tabIndex": "-1",
|
|
65
|
-
"onClick": (event) => {
|
|
66
|
-
handleClick(event, item);
|
|
67
|
-
}
|
|
68
|
-
}, [item?.icon ? createVNode(FaIcon, {
|
|
69
|
-
"name": item?.icon
|
|
70
|
-
}, null) : null, createVNode("span", null, [item.label])]))])]), [[vShow, state.visible]])]
|
|
71
|
-
}));
|
|
72
|
-
return useExpose(expose, {
|
|
73
|
-
/** @description 是否显示 */
|
|
74
|
-
visible: computed(() => state.visible),
|
|
75
|
-
/** @description 打开菜单 */
|
|
76
|
-
open,
|
|
77
|
-
/** @description 关闭菜单 */
|
|
78
|
-
close
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
export {
|
|
83
|
-
ContextMenu as default
|
|
84
|
-
};
|
|
1
|
+
import{defineComponent as e,reactive as i,onMounted as l,createVNode as o,Transition as t,withDirectives as s,vShow as n,computed as a}from"vue";import{useGlobalSize as p}from"element-plus";import{FaIcon as m}from"../../icon/index.mjs";import{useRender as c,useExpose as r,definePropType as d}from"@fast-china/utils";import{useEventListener as u}from"@vueuse/core";import{isObject as f}from"lodash-unified";const x=/* @__PURE__ */e({name:"FaContextMenu",props:{data:{type:d(Array),default:()=>[]}},emits:{click:(e,i)=>e instanceof MouseEvent&&f(i)},setup(e,{emit:d,expose:f}){const x=p(),b=i({visible:!1,axis:{x:0,y:0}}),v=()=>{b.visible=!1};return l(()=>{u(document,"click",v)}),c(()=>o(t,{name:"el-zoom-in-top"},{default:()=>[s(o("div",{class:["fa-context-menu",`fa-context-menu-${x.value}`,"el-popper el-dropdown__popper"],style:{top:`${b.axis.y+5}px`,left:`${b.axis.x+14}px`},key:Math.random()},[o("ul",{class:"el-dropdown-menu"},[e.data.filter(e=>!e.hide).map(e=>o("li",{class:["el-dropdown-menu__item",!0===e?.disabled?"is-disabled":""],tabIndex:"-1",onClick:i=>{((e,i)=>{i?.disabled||(i?.click&&i.click(e,i),d("click",e,i))})(i,e)}},[e?.icon?o(m,{name:e?.icon},null):null,o("span",null,[e.label])]))])]),[[n,b.visible]])]})),r(f,{visible:a(()=>b.visible),open:(e={x:0,y:0})=>{b.axis=e,b.visible=!0},close:v})}});export{x as default};
|
|
85
2
|
//# sourceMappingURL=contextMenu.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextMenu.mjs","sources":["../../../../../packages/components/contextMenu/src/contextMenu.tsx"],"sourcesContent":["import { Transition, computed, defineComponent, onMounted, reactive } from \"vue\";\nimport { useGlobalSize } from \"element-plus\";\nimport { FaIcon } from \"@fast-element-plus/components/icon\";\nimport { definePropType, useExpose, useRender } from \"@fast-china/utils\";\nimport { useEventListener } from \"@vueuse/core\";\nimport { isObject } from \"lodash-unified\";\nimport type { FaContextMenuData } from \"./contextMenu.type\";\n\nexport default defineComponent({\n\tname: \"FaContextMenu\",\n\tprops: {\n\t\t/** @description 数据 */\n\t\tdata: {\n\t\t\ttype: definePropType<FaContextMenuData[]>(Array),\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\temits: {\n\t\t/** @description 点击事件 */\n\t\tclick: (event: MouseEvent, data: FaContextMenuData) => event instanceof MouseEvent && isObject(data),\n\t},\n\tsetup(props, { emit, expose }) {\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tvisible: false,\n\t\t\taxis: {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t},\n\t\t});\n\n\t\tconst handleClick = (event: MouseEvent, data: FaContextMenuData): void => {\n\t\t\tif (data?.disabled) return;\n\t\t\tdata?.click && data.click(event, data);\n\t\t\temit(\"click\", event, data);\n\t\t};\n\n\t\tconst open = (axis: { x: number; y: number } = { x: 0, y: 0 }): void => {\n\t\t\tstate.axis = axis;\n\t\t\tstate.visible = true;\n\t\t};\n\n\t\tconst close = (): void => {\n\t\t\tstate.visible = false;\n\t\t};\n\n\t\tonMounted(() => {\n\t\t\tuseEventListener(document, \"click\", close);\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<Transition name=\"el-zoom-in-top\">\n\t\t\t\t<div\n\t\t\t\t\tclass={[\"fa-context-menu\", `fa-context-menu-${_globalSize.value}`, \"el-popper el-dropdown__popper\"]}\n\t\t\t\t\tstyle={{ top: `${state.axis.y + 5}px`, left: `${state.axis.x + 14}px` }}\n\t\t\t\t\tvShow={state.visible}\n\t\t\t\t\tkey={Math.random()}\n\t\t\t\t>\n\t\t\t\t\t<ul class=\"el-dropdown-menu\">\n\t\t\t\t\t\t{props.data\n\t\t\t\t\t\t\t.filter((f) => !f.hide)\n\t\t\t\t\t\t\t.map((item) => (\n\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\tclass={[\"el-dropdown-menu__item\", item?.disabled === true ? \"is-disabled\" : \"\"]}\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\thandleClick(event, item);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{item?.icon ? <FaIcon name={item?.icon} /> : null}\n\t\t\t\t\t\t\t\t\t<span>{item.label}</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</Transition>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 是否显示 */\n\t\t\tvisible: computed(() => state.visible),\n\t\t\t/** @description 打开菜单 */\n\t\t\topen,\n\t\t\t/** @description 关闭菜单 */\n\t\t\tclose,\n\t\t});\n\t},\n});\n"],"names":["name","props","data","type","definePropType","Array","default","emits","click","event","MouseEvent","isObject","setup","emit","expose","_globalSize","useGlobalSize","state","reactive","visible","axis","x","y","
|
|
1
|
+
{"version":3,"file":"contextMenu.mjs","sources":["../../../../../packages/components/contextMenu/src/contextMenu.tsx"],"sourcesContent":["import { Transition, computed, defineComponent, onMounted, reactive } from \"vue\";\nimport { useGlobalSize } from \"element-plus\";\nimport { FaIcon } from \"@fast-element-plus/components/icon\";\nimport { definePropType, useExpose, useRender } from \"@fast-china/utils\";\nimport { useEventListener } from \"@vueuse/core\";\nimport { isObject } from \"lodash-unified\";\nimport type { FaContextMenuData } from \"./contextMenu.type\";\n\nexport default defineComponent({\n\tname: \"FaContextMenu\",\n\tprops: {\n\t\t/** @description 数据 */\n\t\tdata: {\n\t\t\ttype: definePropType<FaContextMenuData[]>(Array),\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\temits: {\n\t\t/** @description 点击事件 */\n\t\tclick: (event: MouseEvent, data: FaContextMenuData) => event instanceof MouseEvent && isObject(data),\n\t},\n\tsetup(props, { emit, expose }) {\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tvisible: false,\n\t\t\taxis: {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t},\n\t\t});\n\n\t\tconst handleClick = (event: MouseEvent, data: FaContextMenuData): void => {\n\t\t\tif (data?.disabled) return;\n\t\t\tdata?.click && data.click(event, data);\n\t\t\temit(\"click\", event, data);\n\t\t};\n\n\t\tconst open = (axis: { x: number; y: number } = { x: 0, y: 0 }): void => {\n\t\t\tstate.axis = axis;\n\t\t\tstate.visible = true;\n\t\t};\n\n\t\tconst close = (): void => {\n\t\t\tstate.visible = false;\n\t\t};\n\n\t\tonMounted(() => {\n\t\t\tuseEventListener(document, \"click\", close);\n\t\t});\n\n\t\tuseRender(() => (\n\t\t\t<Transition name=\"el-zoom-in-top\">\n\t\t\t\t<div\n\t\t\t\t\tclass={[\"fa-context-menu\", `fa-context-menu-${_globalSize.value}`, \"el-popper el-dropdown__popper\"]}\n\t\t\t\t\tstyle={{ top: `${state.axis.y + 5}px`, left: `${state.axis.x + 14}px` }}\n\t\t\t\t\tvShow={state.visible}\n\t\t\t\t\tkey={Math.random()}\n\t\t\t\t>\n\t\t\t\t\t<ul class=\"el-dropdown-menu\">\n\t\t\t\t\t\t{props.data\n\t\t\t\t\t\t\t.filter((f) => !f.hide)\n\t\t\t\t\t\t\t.map((item) => (\n\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\tclass={[\"el-dropdown-menu__item\", item?.disabled === true ? \"is-disabled\" : \"\"]}\n\t\t\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t\t\t\tonClick={(event: MouseEvent) => {\n\t\t\t\t\t\t\t\t\t\thandleClick(event, item);\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{item?.icon ? <FaIcon name={item?.icon} /> : null}\n\t\t\t\t\t\t\t\t\t<span>{item.label}</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</Transition>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 是否显示 */\n\t\t\tvisible: computed(() => state.visible),\n\t\t\t/** @description 打开菜单 */\n\t\t\topen,\n\t\t\t/** @description 关闭菜单 */\n\t\t\tclose,\n\t\t});\n\t},\n});\n"],"names":["ContextMenu","name","props","data","type","definePropType","Array","default","emits","click","event","MouseEvent","isObject","setup","emit","expose","_globalSize","useGlobalSize","state","reactive","visible","axis","x","y","close","onMounted","useEventListener","document","useRender","_createVNode","Transition","_withDirectives","class","value","style","top","left","key","Math","random","filter","f","hide","map","item","disabled","tabIndex","onClick","handleClick","icon","FaIcon","label","_vShow","useExpose","computed","open"],"mappings":"uZAQA,MAAAA,mBAA+B,CAC9BC,KAAM,gBACNC,MAAO,CAENC,KAAM,CACLC,KAAMC,EAAoCC,OAC1CC,QAASA,IAAM,KAGjBC,MAAO,CAENC,MAAOA,CAACC,EAAmBP,IAA4BO,aAAiBC,YAAcC,EAAST,IAEhGU,KAAAA,CAAMX,GAAOY,KAAEA,EAAAA,OAAMC,IACpB,MAAMC,EAAcC,IAEdC,EAAQC,EAAS,CACtBC,SAAS,EACTC,KAAM,CACLC,EAAG,EACHC,EAAG,KAeCC,EAAQA,KACbN,EAAME,SAAU,GAmCjB,OAhCAK,EAAU,KACTC,EAAiBC,SAAU,QAASH,KAGrCI,EAAU,IAAAC,EAAAC,EAAA,CAAA7B,KAAA,kBAAA,CAAAM,QAAAA,IAAA,CAAAwB,EAAAF,EAAA,MAAA,CAAAG,MAGA,CAAC,kBAAmB,mBAAmBhB,EAAYiB,QAAS,iCAAgCC,MAC5F,CAAEC,IAAK,GAAGjB,EAAMG,KAAKE,EAAI,MAAOa,KAAM,GAAGlB,EAAMG,KAAKC,EAAI,QAAQe,IAElEC,KAAKC,UAAQ,CAAAV,EAAA,KAAA,CAAAG,MAAA,oBAAA,CAGhB9B,EAAMC,KACLqC,OAAQC,IAAOA,EAAEC,MACjBC,IAAKC,GAAIf,EAAA,KAAA,CAAAG,MAED,CAAC,0BAA6C,IAAnBY,GAAMC,SAAoB,cAAgB,IAAGC,SAAA,KAAAC,QAErErC,IAlCGsC,EAACtC,EAAmBP,KACnCA,GAAM0C,WACV1C,GAAMM,OAASN,EAAKM,MAAMC,EAAOP,GACjCW,EAAK,QAASJ,EAAOP,KAgCd6C,CAAYtC,EAAOkC,KACnB,CAEAA,GAAMK,KAAIpB,EAAAqB,EAAA,CAAAjD,KAAiB2C,GAAMK,MAAI,MAAO,KAAIpB,EAAA,OAAA,KAAA,CAC1Ce,EAAKO,eAEZ,CAAA,CAAAC,EAjBGlC,EAAME,eAuBTiC,EAAUtC,EAAQ,CAExBK,QAASkC,EAAS,IAAMpC,EAAME,SAE9BmC,KA7CYA,CAAClC,EAAiC,CAAEC,EAAG,EAAGC,EAAG,MACzDL,EAAMG,KAAOA,EACbH,EAAME,SAAU,GA6ChBI,SAEF"}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Dialog from "./src/dialog.mjs";
|
|
3
|
-
import { faDialogEmits, faDialogProps } from "./src/dialog.mjs";
|
|
4
|
-
const FaDialog = withInstall(Dialog);
|
|
5
|
-
export {
|
|
6
|
-
FaDialog,
|
|
7
|
-
FaDialog as default,
|
|
8
|
-
faDialogEmits,
|
|
9
|
-
faDialogProps
|
|
10
|
-
};
|
|
1
|
+
import{withInstall as o}from"@fast-china/utils";import r from"./src/dialog.mjs";import{faDialogEmits as m,faDialogProps as s}from"./src/dialog.mjs";const t=o(r);export{t as FaDialog,t as default,m as faDialogEmits,s as faDialogProps};
|
|
11
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../packages/components/dialog/index.ts"],"sourcesContent":["import { withInstall } from \"@fast-china/utils\";\nimport Dialog, { faDialogEmits, faDialogProps } from \"./src/dialog\";\nimport type { ExtractPropTypes } from \"vue\";\n\nexport const FaDialog = withInstall(Dialog);\nexport default FaDialog;\n\nexport { faDialogProps, faDialogEmits };\n\nexport type FaDialogInstance = InstanceType<typeof Dialog>;\n\nexport type FaDialogProps = ExtractPropTypes<typeof faDialogProps>;\n\nexport type FaDialogEmits = typeof faDialogEmits;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../packages/components/dialog/index.ts"],"sourcesContent":["import { withInstall } from \"@fast-china/utils\";\nimport Dialog, { faDialogEmits, faDialogProps } from \"./src/dialog\";\nimport type { ExtractPropTypes } from \"vue\";\n\nexport const FaDialog = withInstall(Dialog);\nexport default FaDialog;\n\nexport { faDialogProps, faDialogEmits };\n\nexport type FaDialogInstance = InstanceType<typeof Dialog>;\n\nexport type FaDialogProps = ExtractPropTypes<typeof faDialogProps>;\n\nexport type FaDialogEmits = typeof faDialogEmits;\n"],"names":["FaDialog","withInstall","Dialog"],"mappings":"oJAIO,MAAMA,EAAWC,EAAYC"}
|