@element-plus/nightly 0.0.20220615 → 0.0.20220618
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +93 -40
- package/dist/index.full.min.js +13 -13
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +11 -11
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +94 -41
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/dialog/src/use-dialog2.mjs +3 -3
- package/es/components/dialog/src/use-dialog2.mjs.map +1 -1
- package/es/components/form/index.mjs +1 -1
- package/es/components/form/index2.mjs +2 -2
- package/es/components/form/src/form.mjs +1 -1
- package/es/components/form/src/form3.mjs +48 -148
- package/es/components/form/src/form3.mjs.map +1 -1
- package/es/components/form/src/form4.mjs +148 -48
- package/es/components/form/src/form4.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer3.mjs +2 -1
- package/es/components/image-viewer/src/image-viewer3.mjs.map +1 -1
- package/es/components/index.mjs +1 -1
- package/es/components/pagination/src/components/pager.vue.d.ts +1 -0
- package/es/components/pagination/src/components/pager4.mjs +15 -12
- package/es/components/pagination/src/components/pager4.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar3.mjs +1 -1
- package/es/components/scrollbar/src/scrollbar3.mjs.map +1 -1
- package/es/components/select/src/select2.mjs +1 -1
- package/es/components/select/src/select2.mjs.map +1 -1
- package/es/components/select-v2/src/select2.mjs +1 -1
- package/es/components/select-v2/src/select2.mjs.map +1 -1
- package/es/components/switch/src/switch4.mjs +16 -3
- package/es/components/switch/src/switch4.mjs.map +1 -1
- package/es/components/tabs/src/tab-nav.mjs +3 -2
- package/es/components/tabs/src/tab-nav.mjs.map +1 -1
- package/es/components/tabs/src/tabs.mjs +2 -1
- package/es/components/tabs/src/tabs.mjs.map +1 -1
- package/es/components/upload/index.d.ts +9 -9
- package/es/components/upload/src/upload-content.d.ts +6 -6
- package/es/components/upload/src/upload-content.vue.d.ts +3 -3
- package/es/components/upload/src/upload-content3.mjs +0 -5
- package/es/components/upload/src/upload-content3.mjs.map +1 -1
- package/es/components/upload/src/upload.vue.d.ts +9 -9
- package/es/components/upload/src/upload4.mjs.map +1 -1
- package/es/components/upload/src/use-handlers.d.ts +11 -10
- package/es/components/upload/src/use-handlers2.mjs +8 -7
- package/es/components/upload/src/use-handlers2.mjs.map +1 -1
- package/es/hooks/use-deprecated/index.d.ts +1 -1
- package/es/hooks/use-deprecated/index2.mjs +1 -1
- package/es/hooks/use-deprecated/index2.mjs.map +1 -1
- package/es/index.mjs +1 -1
- package/es/version.d.ts +1 -1
- package/es/version2.mjs +1 -1
- package/es/version2.mjs.map +1 -1
- package/lib/components/dialog/src/use-dialog2.js +4 -4
- package/lib/components/dialog/src/use-dialog2.js.map +1 -1
- package/lib/components/form/index.js +1 -1
- package/lib/components/form/index2.js +2 -2
- package/lib/components/form/src/form.js +1 -1
- package/lib/components/form/src/form3.js +48 -147
- package/lib/components/form/src/form3.js.map +1 -1
- package/lib/components/form/src/form4.js +147 -48
- package/lib/components/form/src/form4.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer3.js +2 -1
- package/lib/components/image-viewer/src/image-viewer3.js.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/pagination/src/components/pager.vue.d.ts +1 -0
- package/lib/components/pagination/src/components/pager4.js +15 -12
- package/lib/components/pagination/src/components/pager4.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar3.js +1 -1
- package/lib/components/scrollbar/src/scrollbar3.js.map +1 -1
- package/lib/components/select/src/select2.js +1 -1
- package/lib/components/select/src/select2.js.map +1 -1
- package/lib/components/select-v2/src/select2.js +1 -1
- package/lib/components/select-v2/src/select2.js.map +1 -1
- package/lib/components/switch/src/switch4.js +14 -1
- package/lib/components/switch/src/switch4.js.map +1 -1
- package/lib/components/tabs/src/tab-nav.js +2 -1
- package/lib/components/tabs/src/tab-nav.js.map +1 -1
- package/lib/components/tabs/src/tabs.js +1 -0
- package/lib/components/tabs/src/tabs.js.map +1 -1
- package/lib/components/upload/index.d.ts +9 -9
- package/lib/components/upload/src/upload-content.d.ts +6 -6
- package/lib/components/upload/src/upload-content.vue.d.ts +3 -3
- package/lib/components/upload/src/upload-content3.js +0 -5
- package/lib/components/upload/src/upload-content3.js.map +1 -1
- package/lib/components/upload/src/upload.vue.d.ts +9 -9
- package/lib/components/upload/src/upload4.js.map +1 -1
- package/lib/components/upload/src/use-handlers.d.ts +11 -10
- package/lib/components/upload/src/use-handlers2.js +7 -6
- package/lib/components/upload/src/use-handlers2.js.map +1 -1
- package/lib/hooks/use-deprecated/index.d.ts +1 -1
- package/lib/hooks/use-deprecated/index2.js +1 -1
- package/lib/hooks/use-deprecated/index2.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version2.js +1 -1
- package/lib/version2.js.map +1 -1
- package/package.json +2 -2
- package/tags.json +1 -1
- package/theme-chalk/el-select-dropdown.css +1 -1
- package/theme-chalk/el-select.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/select-dropdown.scss +6 -0
- package/web-types.json +1 -1
|
@@ -2,156 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
require('../../../constants/index2.js');
|
|
6
6
|
require('../../../utils/index2.js');
|
|
7
|
-
require('../../../
|
|
8
|
-
require('../../../
|
|
9
|
-
var form = require('./form4.js');
|
|
10
|
-
var utils = require('./utils2.js');
|
|
11
|
-
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
12
|
-
var index = require('../../../hooks/use-common-props/index2.js');
|
|
13
|
-
var index$1 = require('../../../hooks/use-namespace/index2.js');
|
|
14
|
-
var error = require('../../../utils/error2.js');
|
|
7
|
+
var runtime = require('../../../utils/vue/props/runtime2.js');
|
|
8
|
+
var size = require('../../../constants/size2.js');
|
|
15
9
|
var shared = require('@vue/shared');
|
|
16
|
-
var
|
|
10
|
+
var core = require('@vueuse/core');
|
|
17
11
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const clearValidate = (props2 = []) => {
|
|
58
|
-
utils.filterFields(fields, props2).forEach((field) => field.clearValidate());
|
|
59
|
-
};
|
|
60
|
-
const isValidatable = vue.computed(() => {
|
|
61
|
-
const hasModel = !!props.model;
|
|
62
|
-
if (!hasModel) {
|
|
63
|
-
error.debugWarn(COMPONENT_NAME, "model is required for validate to work.");
|
|
64
|
-
}
|
|
65
|
-
return hasModel;
|
|
66
|
-
});
|
|
67
|
-
const obtainValidateFields = (props2) => {
|
|
68
|
-
if (fields.length === 0)
|
|
69
|
-
return [];
|
|
70
|
-
const filteredFields = utils.filterFields(fields, props2);
|
|
71
|
-
if (!filteredFields.length) {
|
|
72
|
-
error.debugWarn(COMPONENT_NAME, "please pass correct props!");
|
|
73
|
-
return [];
|
|
74
|
-
}
|
|
75
|
-
return filteredFields;
|
|
76
|
-
};
|
|
77
|
-
const validate = async (callback) => validateField(void 0, callback);
|
|
78
|
-
const doValidateField = async (props2 = []) => {
|
|
79
|
-
if (!isValidatable.value)
|
|
80
|
-
return false;
|
|
81
|
-
const fields2 = obtainValidateFields(props2);
|
|
82
|
-
if (fields2.length === 0)
|
|
83
|
-
return true;
|
|
84
|
-
let validationErrors = {};
|
|
85
|
-
for (const field of fields2) {
|
|
86
|
-
try {
|
|
87
|
-
await field.validate("");
|
|
88
|
-
} catch (fields3) {
|
|
89
|
-
validationErrors = {
|
|
90
|
-
...validationErrors,
|
|
91
|
-
...fields3
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (Object.keys(validationErrors).length === 0)
|
|
96
|
-
return true;
|
|
97
|
-
return Promise.reject(validationErrors);
|
|
98
|
-
};
|
|
99
|
-
const validateField = async (modelProps = [], callback) => {
|
|
100
|
-
const shouldThrow = !shared.isFunction(callback);
|
|
101
|
-
try {
|
|
102
|
-
const result = await doValidateField(modelProps);
|
|
103
|
-
if (result === true) {
|
|
104
|
-
callback == null ? void 0 : callback(result);
|
|
105
|
-
}
|
|
106
|
-
return result;
|
|
107
|
-
} catch (e) {
|
|
108
|
-
const invalidFields = e;
|
|
109
|
-
if (props.scrollToError) {
|
|
110
|
-
scrollToField(Object.keys(invalidFields)[0]);
|
|
111
|
-
}
|
|
112
|
-
callback == null ? void 0 : callback(false, invalidFields);
|
|
113
|
-
return shouldThrow && Promise.reject(invalidFields);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const scrollToField = (prop) => {
|
|
117
|
-
var _a;
|
|
118
|
-
const field = utils.filterFields(fields, prop)[0];
|
|
119
|
-
if (field) {
|
|
120
|
-
(_a = field.$el) == null ? void 0 : _a.scrollIntoView();
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
vue.watch(() => props.rules, () => {
|
|
124
|
-
if (props.validateOnRuleChange) {
|
|
125
|
-
validate().catch((err) => error.debugWarn(err));
|
|
126
|
-
}
|
|
127
|
-
}, { deep: true });
|
|
128
|
-
vue.provide(form$1.formContextKey, vue.reactive({
|
|
129
|
-
...vue.toRefs(props),
|
|
130
|
-
emit,
|
|
131
|
-
resetFields,
|
|
132
|
-
clearValidate,
|
|
133
|
-
validateField,
|
|
134
|
-
addField,
|
|
135
|
-
removeField,
|
|
136
|
-
...utils.useFormLabelWidth()
|
|
137
|
-
}));
|
|
138
|
-
expose({
|
|
139
|
-
validate,
|
|
140
|
-
validateField,
|
|
141
|
-
resetFields,
|
|
142
|
-
clearValidate,
|
|
143
|
-
scrollToField
|
|
144
|
-
});
|
|
145
|
-
return (_ctx, _cache) => {
|
|
146
|
-
return vue.openBlock(), vue.createElementBlock("form", {
|
|
147
|
-
class: vue.normalizeClass(vue.unref(formClasses))
|
|
148
|
-
}, [
|
|
149
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
150
|
-
], 2);
|
|
151
|
-
};
|
|
152
|
-
}
|
|
12
|
+
const formProps = runtime.buildProps({
|
|
13
|
+
model: Object,
|
|
14
|
+
rules: {
|
|
15
|
+
type: runtime.definePropType(Object)
|
|
16
|
+
},
|
|
17
|
+
labelPosition: {
|
|
18
|
+
type: String,
|
|
19
|
+
values: ["left", "right", "top"],
|
|
20
|
+
default: "right"
|
|
21
|
+
},
|
|
22
|
+
labelWidth: {
|
|
23
|
+
type: [String, Number],
|
|
24
|
+
default: ""
|
|
25
|
+
},
|
|
26
|
+
labelSuffix: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: ""
|
|
29
|
+
},
|
|
30
|
+
inline: Boolean,
|
|
31
|
+
inlineMessage: Boolean,
|
|
32
|
+
statusIcon: Boolean,
|
|
33
|
+
showMessage: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
type: String,
|
|
39
|
+
values: size.componentSizes
|
|
40
|
+
},
|
|
41
|
+
disabled: Boolean,
|
|
42
|
+
validateOnRuleChange: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true
|
|
45
|
+
},
|
|
46
|
+
hideRequiredAsterisk: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
scrollToError: Boolean
|
|
153
51
|
});
|
|
154
|
-
|
|
52
|
+
const formEmits = {
|
|
53
|
+
validate: (prop, isValid, message) => (shared.isArray(prop) || shared.isString(prop)) && core.isBoolean(isValid) && shared.isString(message)
|
|
54
|
+
};
|
|
155
55
|
|
|
156
|
-
exports
|
|
56
|
+
exports.formEmits = formEmits;
|
|
57
|
+
exports.formProps = formProps;
|
|
157
58
|
//# sourceMappingURL=form3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form3.js","sources":["../../../../../../packages/components/form/src/form.
|
|
1
|
+
{"version":3,"file":"form3.js","sources":["../../../../../../packages/components/form/src/form.ts"],"sourcesContent":["import { componentSizes } from '@element-plus/constants'\nimport {\n buildProps,\n definePropType,\n isArray,\n isBoolean,\n isString,\n} from '@element-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type { FormItemProp } from './form-item'\nimport type { FormRules } from '@element-plus/tokens'\n\nexport const formProps = buildProps({\n model: Object,\n rules: {\n type: definePropType<FormRules>(Object),\n },\n labelPosition: {\n type: String,\n values: ['left', 'right', 'top'] as const,\n default: 'right',\n },\n labelWidth: {\n type: [String, Number],\n default: '',\n },\n labelSuffix: {\n type: String,\n default: '',\n },\n inline: Boolean,\n inlineMessage: Boolean,\n statusIcon: Boolean,\n showMessage: {\n type: Boolean,\n default: true,\n },\n size: {\n type: String,\n values: componentSizes,\n },\n disabled: Boolean,\n validateOnRuleChange: {\n type: Boolean,\n default: true,\n },\n hideRequiredAsterisk: {\n type: Boolean,\n default: false,\n },\n scrollToError: Boolean,\n} as const)\nexport type FormProps = ExtractPropTypes<typeof formProps>\n\nexport const formEmits = {\n validate: (prop: FormItemProp, isValid: boolean, message: string) =>\n (isArray(prop) || isString(prop)) &&\n isBoolean(isValid) &&\n isString(message),\n}\nexport type FormEmits = typeof formEmits\n"],"names":["buildProps","definePropType","componentSizes","isArray","isString","isBoolean"],"mappings":";;;;;;;;;;;AAQY,MAAC,SAAS,GAAGA,kBAAU,CAAC;AACpC,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAEC,sBAAc,CAAC,MAAM,CAAC;AAChC,GAAG;AACH,EAAE,aAAa,EAAE;AACjB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;AACpC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,aAAa,EAAE,OAAO;AACxB,EAAE,UAAU,EAAE,OAAO;AACrB,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAEC,mBAAc;AAC1B,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,oBAAoB,EAAE;AACxB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,oBAAoB,EAAE;AACxB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,aAAa,EAAE,OAAO;AACxB,CAAC,EAAE;AACS,MAAC,SAAS,GAAG;AACzB,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,KAAK,CAACC,cAAO,CAAC,IAAI,CAAC,IAAIC,eAAQ,CAAC,IAAI,CAAC,KAAKC,cAAS,CAAC,OAAO,CAAC,IAAID,eAAQ,CAAC,OAAO,CAAC;AACpH;;;;;"}
|
|
@@ -2,57 +2,156 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('
|
|
5
|
+
var vue = require('vue');
|
|
6
6
|
require('../../../utils/index2.js');
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
require('../../../tokens/index2.js');
|
|
8
|
+
require('../../../hooks/index2.js');
|
|
9
|
+
var form = require('./form3.js');
|
|
10
|
+
var utils = require('./utils2.js');
|
|
11
|
+
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
|
|
12
|
+
var index = require('../../../hooks/use-common-props/index2.js');
|
|
13
|
+
var index$1 = require('../../../hooks/use-namespace/index2.js');
|
|
14
|
+
var error = require('../../../utils/error2.js');
|
|
9
15
|
var shared = require('@vue/shared');
|
|
10
|
-
var
|
|
16
|
+
var form$1 = require('../../../tokens/form2.js');
|
|
11
17
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
rules: {
|
|
15
|
-
type: runtime.definePropType(Object)
|
|
16
|
-
},
|
|
17
|
-
labelPosition: {
|
|
18
|
-
type: String,
|
|
19
|
-
values: ["left", "right", "top"],
|
|
20
|
-
default: "right"
|
|
21
|
-
},
|
|
22
|
-
labelWidth: {
|
|
23
|
-
type: [String, Number],
|
|
24
|
-
default: ""
|
|
25
|
-
},
|
|
26
|
-
labelSuffix: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: ""
|
|
29
|
-
},
|
|
30
|
-
inline: Boolean,
|
|
31
|
-
inlineMessage: Boolean,
|
|
32
|
-
statusIcon: Boolean,
|
|
33
|
-
showMessage: {
|
|
34
|
-
type: Boolean,
|
|
35
|
-
default: true
|
|
36
|
-
},
|
|
37
|
-
size: {
|
|
38
|
-
type: String,
|
|
39
|
-
values: size.componentSizes
|
|
40
|
-
},
|
|
41
|
-
disabled: Boolean,
|
|
42
|
-
validateOnRuleChange: {
|
|
43
|
-
type: Boolean,
|
|
44
|
-
default: true
|
|
45
|
-
},
|
|
46
|
-
hideRequiredAsterisk: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: false
|
|
49
|
-
},
|
|
50
|
-
scrollToError: Boolean
|
|
51
|
-
});
|
|
52
|
-
const formEmits = {
|
|
53
|
-
validate: (prop, isValid, message) => (shared.isArray(prop) || shared.isString(prop)) && core.isBoolean(isValid) && shared.isString(message)
|
|
18
|
+
const __default__ = {
|
|
19
|
+
name: "ElForm"
|
|
54
20
|
};
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
22
|
+
...__default__,
|
|
23
|
+
props: form.formProps,
|
|
24
|
+
emits: form.formEmits,
|
|
25
|
+
setup(__props, { expose, emit }) {
|
|
26
|
+
const props = __props;
|
|
27
|
+
const COMPONENT_NAME = "ElForm";
|
|
28
|
+
const fields = [];
|
|
29
|
+
const formSize = index.useSize();
|
|
30
|
+
const ns = index$1.useNamespace("form");
|
|
31
|
+
const formClasses = vue.computed(() => {
|
|
32
|
+
const { labelPosition, inline } = props;
|
|
33
|
+
return [
|
|
34
|
+
ns.b(),
|
|
35
|
+
ns.m(formSize.value || "default"),
|
|
36
|
+
{
|
|
37
|
+
[ns.m(`label-${labelPosition}`)]: labelPosition,
|
|
38
|
+
[ns.m("inline")]: inline
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
});
|
|
42
|
+
const addField = (field) => {
|
|
43
|
+
fields.push(field);
|
|
44
|
+
};
|
|
45
|
+
const removeField = (field) => {
|
|
46
|
+
if (field.prop) {
|
|
47
|
+
fields.splice(fields.indexOf(field), 1);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const resetFields = (properties = []) => {
|
|
51
|
+
if (!props.model) {
|
|
52
|
+
error.debugWarn(COMPONENT_NAME, "model is required for resetFields to work.");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
utils.filterFields(fields, properties).forEach((field) => field.resetField());
|
|
56
|
+
};
|
|
57
|
+
const clearValidate = (props2 = []) => {
|
|
58
|
+
utils.filterFields(fields, props2).forEach((field) => field.clearValidate());
|
|
59
|
+
};
|
|
60
|
+
const isValidatable = vue.computed(() => {
|
|
61
|
+
const hasModel = !!props.model;
|
|
62
|
+
if (!hasModel) {
|
|
63
|
+
error.debugWarn(COMPONENT_NAME, "model is required for validate to work.");
|
|
64
|
+
}
|
|
65
|
+
return hasModel;
|
|
66
|
+
});
|
|
67
|
+
const obtainValidateFields = (props2) => {
|
|
68
|
+
if (fields.length === 0)
|
|
69
|
+
return [];
|
|
70
|
+
const filteredFields = utils.filterFields(fields, props2);
|
|
71
|
+
if (!filteredFields.length) {
|
|
72
|
+
error.debugWarn(COMPONENT_NAME, "please pass correct props!");
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
return filteredFields;
|
|
76
|
+
};
|
|
77
|
+
const validate = async (callback) => validateField(void 0, callback);
|
|
78
|
+
const doValidateField = async (props2 = []) => {
|
|
79
|
+
if (!isValidatable.value)
|
|
80
|
+
return false;
|
|
81
|
+
const fields2 = obtainValidateFields(props2);
|
|
82
|
+
if (fields2.length === 0)
|
|
83
|
+
return true;
|
|
84
|
+
let validationErrors = {};
|
|
85
|
+
for (const field of fields2) {
|
|
86
|
+
try {
|
|
87
|
+
await field.validate("");
|
|
88
|
+
} catch (fields3) {
|
|
89
|
+
validationErrors = {
|
|
90
|
+
...validationErrors,
|
|
91
|
+
...fields3
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (Object.keys(validationErrors).length === 0)
|
|
96
|
+
return true;
|
|
97
|
+
return Promise.reject(validationErrors);
|
|
98
|
+
};
|
|
99
|
+
const validateField = async (modelProps = [], callback) => {
|
|
100
|
+
const shouldThrow = !shared.isFunction(callback);
|
|
101
|
+
try {
|
|
102
|
+
const result = await doValidateField(modelProps);
|
|
103
|
+
if (result === true) {
|
|
104
|
+
callback == null ? void 0 : callback(result);
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
} catch (e) {
|
|
108
|
+
const invalidFields = e;
|
|
109
|
+
if (props.scrollToError) {
|
|
110
|
+
scrollToField(Object.keys(invalidFields)[0]);
|
|
111
|
+
}
|
|
112
|
+
callback == null ? void 0 : callback(false, invalidFields);
|
|
113
|
+
return shouldThrow && Promise.reject(invalidFields);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const scrollToField = (prop) => {
|
|
117
|
+
var _a;
|
|
118
|
+
const field = utils.filterFields(fields, prop)[0];
|
|
119
|
+
if (field) {
|
|
120
|
+
(_a = field.$el) == null ? void 0 : _a.scrollIntoView();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
vue.watch(() => props.rules, () => {
|
|
124
|
+
if (props.validateOnRuleChange) {
|
|
125
|
+
validate().catch((err) => error.debugWarn(err));
|
|
126
|
+
}
|
|
127
|
+
}, { deep: true });
|
|
128
|
+
vue.provide(form$1.formContextKey, vue.reactive({
|
|
129
|
+
...vue.toRefs(props),
|
|
130
|
+
emit,
|
|
131
|
+
resetFields,
|
|
132
|
+
clearValidate,
|
|
133
|
+
validateField,
|
|
134
|
+
addField,
|
|
135
|
+
removeField,
|
|
136
|
+
...utils.useFormLabelWidth()
|
|
137
|
+
}));
|
|
138
|
+
expose({
|
|
139
|
+
validate,
|
|
140
|
+
validateField,
|
|
141
|
+
resetFields,
|
|
142
|
+
clearValidate,
|
|
143
|
+
scrollToField
|
|
144
|
+
});
|
|
145
|
+
return (_ctx, _cache) => {
|
|
146
|
+
return vue.openBlock(), vue.createElementBlock("form", {
|
|
147
|
+
class: vue.normalizeClass(vue.unref(formClasses))
|
|
148
|
+
}, [
|
|
149
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
150
|
+
], 2);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
var Form = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/form/src/form.vue"]]);
|
|
55
155
|
|
|
56
|
-
exports
|
|
57
|
-
exports.formProps = formProps;
|
|
156
|
+
exports["default"] = Form;
|
|
58
157
|
//# sourceMappingURL=form4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form4.js","sources":["../../../../../../packages/components/form/src/form.
|
|
1
|
+
{"version":3,"file":"form4.js","sources":["../../../../../../packages/components/form/src/form.vue"],"sourcesContent":["<template>\n <form :class=\"formClasses\">\n <slot />\n </form>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, provide, reactive, toRefs, watch } from 'vue'\nimport { debugWarn, isFunction } from '@element-plus/utils'\nimport { formContextKey } from '@element-plus/tokens'\nimport { useNamespace, useSize } from '@element-plus/hooks'\nimport { formEmits, formProps } from './form'\nimport { filterFields, useFormLabelWidth } from './utils'\n\nimport type { ValidateFieldsError } from 'async-validator'\nimport type { Arrayable } from '@element-plus/utils'\nimport type {\n FormContext,\n FormItemContext,\n FormValidateCallback,\n FormValidationResult,\n} from '@element-plus/tokens'\nimport type { FormItemProp } from './form-item'\n\nconst COMPONENT_NAME = 'ElForm'\ndefineOptions({\n name: 'ElForm',\n})\nconst props = defineProps(formProps)\nconst emit = defineEmits(formEmits)\n\nconst fields: FormItemContext[] = []\n\nconst formSize = useSize()\nconst ns = useNamespace('form')\nconst formClasses = computed(() => {\n const { labelPosition, inline } = props\n return [\n ns.b(),\n // todo: in v2.2.0, we can remove default\n // in fact, remove it doesn't affect the final style\n ns.m(formSize.value || 'default'),\n {\n [ns.m(`label-${labelPosition}`)]: labelPosition,\n [ns.m('inline')]: inline,\n },\n ]\n})\n\nconst addField: FormContext['addField'] = (field) => {\n fields.push(field)\n}\n\nconst removeField: FormContext['removeField'] = (field) => {\n if (field.prop) {\n fields.splice(fields.indexOf(field), 1)\n }\n}\n\nconst resetFields: FormContext['resetFields'] = (properties = []) => {\n if (!props.model) {\n debugWarn(COMPONENT_NAME, 'model is required for resetFields to work.')\n return\n }\n filterFields(fields, properties).forEach((field) => field.resetField())\n}\n\nconst clearValidate: FormContext['clearValidate'] = (props = []) => {\n filterFields(fields, props).forEach((field) => field.clearValidate())\n}\n\nconst isValidatable = computed(() => {\n const hasModel = !!props.model\n if (!hasModel) {\n debugWarn(COMPONENT_NAME, 'model is required for validate to work.')\n }\n return hasModel\n})\n\nconst obtainValidateFields = (props: Arrayable<FormItemProp>) => {\n if (fields.length === 0) return []\n\n const filteredFields = filterFields(fields, props)\n if (!filteredFields.length) {\n debugWarn(COMPONENT_NAME, 'please pass correct props!')\n return []\n }\n return filteredFields\n}\n\nconst validate = async (\n callback?: FormValidateCallback\n): FormValidationResult => validateField(undefined, callback)\n\nconst doValidateField = async (\n props: Arrayable<FormItemProp> = []\n): Promise<boolean> => {\n if (!isValidatable.value) return false\n\n const fields = obtainValidateFields(props)\n if (fields.length === 0) return true\n\n let validationErrors: ValidateFieldsError = {}\n for (const field of fields) {\n try {\n await field.validate('')\n } catch (fields) {\n validationErrors = {\n ...validationErrors,\n ...(fields as ValidateFieldsError),\n }\n }\n }\n\n if (Object.keys(validationErrors).length === 0) return true\n return Promise.reject(validationErrors)\n}\n\nconst validateField: FormContext['validateField'] = async (\n modelProps = [],\n callback\n) => {\n const shouldThrow = !isFunction(callback)\n try {\n const result = await doValidateField(modelProps)\n // When result is false meaning that the fields are not validatable\n if (result === true) {\n callback?.(result)\n }\n return result\n } catch (e) {\n const invalidFields = e as ValidateFieldsError\n\n if (props.scrollToError) {\n scrollToField(Object.keys(invalidFields)[0])\n }\n callback?.(false, invalidFields)\n return shouldThrow && Promise.reject(invalidFields)\n }\n}\n\nconst scrollToField = (prop: FormItemProp) => {\n const field = filterFields(fields, prop)[0]\n if (field) {\n field.$el?.scrollIntoView()\n }\n}\n\nwatch(\n () => props.rules,\n () => {\n if (props.validateOnRuleChange) {\n validate().catch((err) => debugWarn(err))\n }\n },\n { deep: true }\n)\n\nprovide(\n formContextKey,\n reactive({\n ...toRefs(props),\n emit,\n\n resetFields,\n clearValidate,\n validateField,\n addField,\n removeField,\n\n ...useFormLabelWidth(),\n })\n)\n\ndefineExpose({\n /** @description validate form */\n validate,\n /** @description validate form field */\n validateField,\n /** @description reset fields */\n resetFields,\n /** @description clear validation status */\n clearValidate,\n /** @description scroll to field */\n scrollToField,\n})\n</script>\n"],"names":["useSize","useNamespace","computed","debugWarn","filterFields","isFunction","watch","provide","reactive","toRefs","useFormLabelWidth"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAA,MAAA,cAAA,GAAA,QAAA,CAAA;AAOA,IAAA,MAAA,SAAA,EAAA,CAAA;AAEA,IAAA,MAAA,WAAAA,aAAA,EAAA,CAAA;AACA,IAAA,MAAA,EAAA,GAAAC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AA,KAAA,CAAA,GAAA,EAAA,CAAA,cAAA,EAAA,CAAA;AAAA,OACA;AAEA,KACA,CAAA;AAEA,IAAAE,SAAA,CAAA,MAAA,KAAA,CAAA,KAAA,EAAA,MAAA;AACA,MAAA,IAAA,KAAA,CAAA,oBAAA,EAAA;AAAA,QACA,QAAA,EAAA,CAAA,KAAA,CAAA,CAAA,GAAA,KAAAH,eAAA,CAAA,GAAA,CAAA,CAAA,CAAA;AAAA,OAEA;AAGA,KAAA,EAAA,EAAA;AAEA,IACAI,iCAAA,EAAAC,YAAA,CAAA;AAAA,MACA,GAAAC,UAAA,CAAA,KAAA,CAAA;AAAA,MAEA,IAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAA;AAAA,MACA,aAAA;AAAA,MACA,QAAA;AAAA,MAEA,WAAA;AAAA,MAEA,GAAAC,uBAAA,EAAA;AAEA,KAAA,CAAA,CAAA,CAAA;AAAA,IAEA,MAAA,CAAA;AAAA,MAEA,QAAA;AAAA,MAEA,aAAA;AAAA,MAEA,WAAA;AAAA,MAEA,aAAA;AAAA,MACA,aAAA;;;;;;;;;;;;;;;"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
require('../../../utils/index2.js');
|
|
6
6
|
var runtime = require('../../../utils/vue/props/runtime2.js');
|
|
7
7
|
var typescript = require('../../../utils/typescript2.js');
|
|
8
|
+
var core = require('@vueuse/core');
|
|
8
9
|
|
|
9
10
|
const imageViewerProps = runtime.buildProps({
|
|
10
11
|
urlList: {
|
|
@@ -37,7 +38,7 @@ const imageViewerProps = runtime.buildProps({
|
|
|
37
38
|
});
|
|
38
39
|
const imageViewerEmits = {
|
|
39
40
|
close: () => true,
|
|
40
|
-
switch: (index) =>
|
|
41
|
+
switch: (index) => core.isNumber(index)
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
exports.imageViewerEmits = imageViewerEmits;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-viewer3.js","sources":["../../../../../../packages/components/image-viewer/src/image-viewer.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"image-viewer3.js","sources":["../../../../../../packages/components/image-viewer/src/image-viewer.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isNumber,\n mutable,\n} from '@element-plus/utils'\nimport type { Component, ExtractPropTypes } from 'vue'\n\nexport type ImageViewerAction =\n | 'zoomIn'\n | 'zoomOut'\n | 'clockwise'\n | 'anticlockwise'\n\nexport const imageViewerProps = buildProps({\n urlList: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n zIndex: {\n type: Number,\n },\n initialIndex: {\n type: Number,\n default: 0,\n },\n infinite: {\n type: Boolean,\n default: true,\n },\n hideOnClickModal: {\n type: Boolean,\n default: false,\n },\n teleported: {\n type: Boolean,\n default: false,\n },\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n} as const)\nexport type ImageViewerProps = ExtractPropTypes<typeof imageViewerProps>\n\nexport const imageViewerEmits = {\n close: () => true,\n switch: (index: number) => isNumber(index),\n}\nexport type ImageViewerEmits = typeof imageViewerEmits\n\nexport interface ImageViewerMode {\n name: string\n icon: Component\n}\n"],"names":["buildProps","definePropType","mutable","isNumber"],"mappings":";;;;;;;;;AAMY,MAAC,gBAAgB,GAAGA,kBAAU,CAAC;AAC3C,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAEC,sBAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAMC,kBAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,gBAAgB,EAAE;AACpB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,kBAAkB,EAAE;AACtB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG;AAChC,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB,EAAE,MAAM,EAAE,CAAC,KAAK,KAAKC,aAAQ,CAAC,KAAK,CAAC;AACpC;;;;;"}
|
package/lib/components/index.js
CHANGED
|
@@ -59,7 +59,7 @@ var tokens = require('./dropdown/src/tokens2.js');
|
|
|
59
59
|
var index$q = require('./dropdown/index2.js');
|
|
60
60
|
var empty = require('./empty/src/empty3.js');
|
|
61
61
|
var index$r = require('./empty/index2.js');
|
|
62
|
-
var form = require('./form/src/
|
|
62
|
+
var form = require('./form/src/form3.js');
|
|
63
63
|
var formItem = require('./form/src/form-item3.js');
|
|
64
64
|
var index$s = require('./form/index2.js');
|
|
65
65
|
var icon = require('./icon/src/icon3.js');
|
|
@@ -66,6 +66,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
66
66
|
quickPrevFocus: import("vue").Ref<boolean>;
|
|
67
67
|
quickNextFocus: import("vue").Ref<boolean>;
|
|
68
68
|
pagers: import("vue").ComputedRef<number[]>;
|
|
69
|
+
tabindex: import("vue").ComputedRef<0 | -1>;
|
|
69
70
|
onMouseEnter: (forward?: boolean) => void;
|
|
70
71
|
onFocus: (forward?: boolean) => void;
|
|
71
72
|
onEnter: (e: UIEvent) => void;
|
|
@@ -10,9 +10,11 @@ var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-hel
|
|
|
10
10
|
var index = require('../../../../hooks/use-namespace/index2.js');
|
|
11
11
|
|
|
12
12
|
const _hoisted_1 = ["onKeyup"];
|
|
13
|
-
const _hoisted_2 = ["aria-current"];
|
|
14
|
-
const _hoisted_3 = ["
|
|
15
|
-
const _hoisted_4 = ["aria-current"];
|
|
13
|
+
const _hoisted_2 = ["aria-current", "tabindex"];
|
|
14
|
+
const _hoisted_3 = ["tabindex"];
|
|
15
|
+
const _hoisted_4 = ["aria-current", "tabindex"];
|
|
16
|
+
const _hoisted_5 = ["tabindex"];
|
|
17
|
+
const _hoisted_6 = ["aria-current", "tabindex"];
|
|
16
18
|
const __default__ = {
|
|
17
19
|
name: "ElPaginationPager"
|
|
18
20
|
};
|
|
@@ -67,6 +69,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
67
69
|
}
|
|
68
70
|
return array;
|
|
69
71
|
});
|
|
72
|
+
const tabindex = vue.computed(() => props.disabled ? -1 : 0);
|
|
70
73
|
vue.watchEffect(() => {
|
|
71
74
|
const halfPagerCount = (props.pagerCount - 1) / 2;
|
|
72
75
|
showPrevMore.value = false;
|
|
@@ -148,7 +151,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
148
151
|
vue.unref(nsPager).is("disabled", _ctx.disabled)
|
|
149
152
|
], "number"]),
|
|
150
153
|
"aria-current": _ctx.currentPage === 1,
|
|
151
|
-
tabindex:
|
|
154
|
+
tabindex: vue.unref(tabindex)
|
|
152
155
|
}, " 1 ", 10, _hoisted_2)) : vue.createCommentVNode("v-if", true),
|
|
153
156
|
showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
|
|
154
157
|
key: 1,
|
|
@@ -158,14 +161,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
158
161
|
vue.unref(nsIcon).b(),
|
|
159
162
|
vue.unref(nsPager).is("disabled", _ctx.disabled)
|
|
160
163
|
]),
|
|
161
|
-
tabindex:
|
|
164
|
+
tabindex: vue.unref(tabindex),
|
|
162
165
|
onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
|
|
163
166
|
onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
|
|
164
167
|
onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
|
|
165
168
|
onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
|
|
166
169
|
}, [
|
|
167
170
|
quickPrevHover.value || quickPrevFocus.value ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.DArrowLeft), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.MoreFilled), { key: 1 }))
|
|
168
|
-
],
|
|
171
|
+
], 42, _hoisted_3)) : vue.createCommentVNode("v-if", true),
|
|
169
172
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
|
|
170
173
|
return vue.openBlock(), vue.createElementBlock("li", {
|
|
171
174
|
key: pager,
|
|
@@ -174,8 +177,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
174
177
|
vue.unref(nsPager).is("disabled", _ctx.disabled)
|
|
175
178
|
], "number"]),
|
|
176
179
|
"aria-current": _ctx.currentPage === pager,
|
|
177
|
-
tabindex:
|
|
178
|
-
}, vue.toDisplayString(pager), 11,
|
|
180
|
+
tabindex: vue.unref(tabindex)
|
|
181
|
+
}, vue.toDisplayString(pager), 11, _hoisted_4);
|
|
179
182
|
}), 128)),
|
|
180
183
|
showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
|
|
181
184
|
key: 2,
|
|
@@ -185,14 +188,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
185
188
|
vue.unref(nsIcon).b(),
|
|
186
189
|
vue.unref(nsPager).is("disabled", _ctx.disabled)
|
|
187
190
|
]),
|
|
188
|
-
tabindex:
|
|
191
|
+
tabindex: vue.unref(tabindex),
|
|
189
192
|
onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
|
|
190
193
|
onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
|
|
191
194
|
onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
|
|
192
195
|
onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
|
|
193
196
|
}, [
|
|
194
197
|
quickNextHover.value || quickNextFocus.value ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.DArrowRight), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.MoreFilled), { key: 1 }))
|
|
195
|
-
],
|
|
198
|
+
], 42, _hoisted_5)) : vue.createCommentVNode("v-if", true),
|
|
196
199
|
_ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
|
|
197
200
|
key: 3,
|
|
198
201
|
class: vue.normalizeClass([[
|
|
@@ -200,8 +203,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
200
203
|
vue.unref(nsPager).is("disabled", _ctx.disabled)
|
|
201
204
|
], "number"]),
|
|
202
205
|
"aria-current": _ctx.currentPage === _ctx.pageCount,
|
|
203
|
-
tabindex:
|
|
204
|
-
}, vue.toDisplayString(_ctx.pageCount), 11,
|
|
206
|
+
tabindex: vue.unref(tabindex)
|
|
207
|
+
}, vue.toDisplayString(_ctx.pageCount), 11, _hoisted_6)) : vue.createCommentVNode("v-if", true)
|
|
205
208
|
], 42, _hoisted_1);
|
|
206
209
|
};
|
|
207
210
|
}
|