@element-plus/nightly 0.0.20211230 → 0.0.20220103
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 +0 -8
- package/dist/index.css +1 -1
- package/dist/index.full.js +47534 -47521
- package/dist/index.full.min.js +6 -6
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +6 -6
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +183 -171
- package/es/components/button/index.d.ts +1 -1
- package/es/components/button/src/button.vue.d.ts +1 -1
- package/es/components/cascader/index.d.ts +6 -6
- package/es/components/cascader/src/index.vue.d.ts +3 -3
- package/es/components/checkbox/index.d.ts +4 -4
- package/es/components/checkbox/src/checkbox-button.vue.d.ts +1 -1
- package/es/components/checkbox/src/checkbox.vue.d.ts +2 -2
- package/es/components/checkbox/src/useCheckbox.d.ts +2 -2
- package/es/components/color-picker/index.d.ts +2 -2
- package/es/components/color-picker/src/index.vue.d.ts +1 -1
- package/es/components/config-provider/index.d.ts +8 -4
- package/es/components/config-provider/index.mjs +1 -1
- package/es/components/config-provider/index.mjs.map +1 -1
- package/es/components/config-provider/src/config-provider.d.ts +26 -1
- package/es/components/config-provider/src/config-provider.mjs +18 -4
- package/es/components/config-provider/src/config-provider.mjs.map +1 -1
- package/es/components/date-picker/index.d.ts +6 -6
- package/es/components/date-picker/src/date-picker.d.ts +3 -3
- package/es/components/descriptions/index.d.ts +1 -1
- package/es/components/descriptions/src/descriptions-cell.mjs +12 -3
- package/es/components/descriptions/src/descriptions-cell.mjs.map +1 -1
- package/es/components/descriptions/src/index.vue.d.ts +1 -1
- package/es/components/descriptions/src/index.vue_vue_type_script_lang.mjs +7 -2
- package/es/components/descriptions/src/index.vue_vue_type_script_lang.mjs.map +1 -1
- package/es/components/descriptions/src/index.vue_vue_type_template_id_788d3854_lang.mjs +14 -17
- package/es/components/descriptions/src/index.vue_vue_type_template_id_788d3854_lang.mjs.map +1 -1
- package/es/components/dialog/index.d.ts +2 -2
- package/es/components/dialog/src/dialog.vue.d.ts +2 -2
- package/es/components/dialog/src/use-dialog.mjs +1 -1
- package/es/components/dialog/src/use-dialog.mjs.map +1 -1
- package/es/components/drawer/index.d.ts +2 -2
- package/es/components/drawer/src/drawer.vue.d.ts +2 -2
- package/es/components/dropdown/index.d.ts +1 -1
- package/es/components/dropdown/src/dropdown.vue.d.ts +1 -1
- package/es/components/image/index.d.ts +2 -2
- package/es/components/image/src/image.vue.d.ts +2 -2
- package/es/components/input/index.d.ts +1 -1
- package/es/components/input/src/input.vue.d.ts +1 -1
- package/es/components/input-number/index.d.ts +3 -3
- package/es/components/input-number/src/input-number.vue.d.ts +3 -3
- package/es/components/loading/src/service.mjs +1 -1
- package/es/components/loading/src/service.mjs.map +1 -1
- package/es/components/message/src/message-method.mjs +1 -1
- package/es/components/message/src/message-method.mjs.map +1 -1
- package/es/components/message-box/src/index.vue_vue_type_script_lang.mjs +1 -1
- package/es/components/message-box/src/index.vue_vue_type_script_lang.mjs.map +1 -1
- package/es/components/message-box/src/index.vue_vue_type_template_id_7035e868_lang.mjs.map +1 -1
- package/es/components/notification/src/notification.vue.d.ts +2 -2
- package/es/components/notification/src/notify.mjs +1 -1
- package/es/components/notification/src/notify.mjs.map +1 -1
- package/es/components/overlay/index.d.ts +1 -1
- package/es/components/overlay/src/overlay.d.ts +1 -1
- package/es/components/popover/src/usePopover.mjs +1 -1
- package/es/components/popover/src/usePopover.mjs.map +1 -1
- package/es/components/popper/src/use-popper/index.mjs +1 -1
- package/es/components/popper/src/use-popper/index.mjs.map +1 -1
- package/es/components/radio/index.d.ts +3 -3
- package/es/components/radio/src/radio-button.vue.d.ts +1 -1
- package/es/components/radio/src/radio.d.ts +1 -1
- package/es/components/radio/src/radio.vue.d.ts +1 -1
- package/es/components/select/index.d.ts +1 -1
- package/es/components/select/src/select.vue.d.ts +1 -1
- package/es/components/select/src/useSelect.d.ts +1 -1
- package/es/components/select-v2/index.d.ts +2 -2
- package/es/components/select-v2/src/select.vue.d.ts +1 -1
- package/es/components/select-v2/src/useSelect.d.ts +1 -1
- package/es/components/table/index.d.ts +1 -1
- package/es/components/table/src/table/style-helper.d.ts +1 -1
- package/es/components/table/src/table.vue.d.ts +1 -1
- package/es/components/table/src/util.mjs +1 -1
- package/es/components/table/src/util.mjs.map +1 -1
- package/es/components/teleport/index.d.ts +1 -1
- package/es/components/teleport/src/teleport.vue.d.ts +1 -1
- package/es/components/time-picker/index.d.ts +6 -6
- package/es/components/time-picker/src/common/picker.vue.d.ts +4 -4
- package/es/components/time-picker/src/common/props.d.ts +1 -1
- package/es/components/time-picker/src/common/props.mjs +1 -1
- package/es/components/time-picker/src/common/props.mjs.map +1 -1
- package/es/components/time-picker/src/time-picker.d.ts +3 -3
- package/es/components/tree/src/model/tree-store.mjs +1 -1
- package/es/components/tree/src/model/tree-store.mjs.map +1 -1
- package/es/defaults.d.ts +11 -1
- package/es/hooks/index.mjs +1 -1
- package/es/hooks/use-common-props/index.d.ts +1 -1
- package/es/hooks/use-common-props/index.mjs +1 -3
- package/es/hooks/use-common-props/index.mjs.map +1 -1
- package/es/hooks/use-global-config/index.d.ts +14 -2
- package/es/hooks/use-global-config/index.mjs +26 -4
- package/es/hooks/use-global-config/index.mjs.map +1 -1
- package/es/hooks/use-popper/index.mjs +1 -1
- package/es/hooks/use-popper/index.mjs.map +1 -1
- package/es/index.d.ts +13 -2
- package/es/index.mjs +1 -1
- package/es/index.mjs.map +1 -1
- package/es/make-installer.d.ts +2 -2
- package/es/make-installer.mjs +14 -17
- package/es/make-installer.mjs.map +1 -1
- package/es/tokens/config-provider.d.ts +2 -2
- package/es/tokens/config-provider.mjs.map +1 -1
- package/es/utils/popup-manager.d.ts +5 -3
- package/es/utils/popup-manager.mjs +21 -25
- package/es/utils/popup-manager.mjs.map +1 -1
- package/es/utils/util.d.ts +2 -8
- package/es/utils/util.mjs +13 -10
- package/es/utils/util.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/global.d.ts +13 -0
- package/lib/components/button/index.d.ts +1 -1
- package/lib/components/button/src/button.vue.d.ts +1 -1
- package/lib/components/cascader/index.d.ts +6 -6
- package/lib/components/cascader/src/index.vue.d.ts +3 -3
- package/lib/components/checkbox/index.d.ts +4 -4
- package/lib/components/checkbox/src/checkbox-button.vue.d.ts +1 -1
- package/lib/components/checkbox/src/checkbox.vue.d.ts +2 -2
- package/lib/components/checkbox/src/useCheckbox.d.ts +2 -2
- package/lib/components/color-picker/index.d.ts +2 -2
- package/lib/components/color-picker/src/index.vue.d.ts +1 -1
- package/lib/components/config-provider/index.d.ts +8 -4
- package/lib/components/config-provider/index.js +1 -2
- package/lib/components/config-provider/index.js.map +1 -1
- package/lib/components/config-provider/src/config-provider.d.ts +26 -1
- package/lib/components/config-provider/src/config-provider.js +17 -2
- package/lib/components/config-provider/src/config-provider.js.map +1 -1
- package/lib/components/date-picker/index.d.ts +6 -6
- package/lib/components/date-picker/src/date-picker.d.ts +3 -3
- package/lib/components/descriptions/index.d.ts +1 -1
- package/lib/components/descriptions/src/descriptions-cell.js +12 -3
- package/lib/components/descriptions/src/descriptions-cell.js.map +1 -1
- package/lib/components/descriptions/src/index.vue.d.ts +1 -1
- package/lib/components/descriptions/src/index.vue_vue_type_script_lang.js +6 -1
- package/lib/components/descriptions/src/index.vue_vue_type_script_lang.js.map +1 -1
- package/lib/components/descriptions/src/index.vue_vue_type_template_id_788d3854_lang.js +13 -16
- package/lib/components/descriptions/src/index.vue_vue_type_template_id_788d3854_lang.js.map +1 -1
- package/lib/components/dialog/index.d.ts +2 -2
- package/lib/components/dialog/src/dialog.vue.d.ts +2 -2
- package/lib/components/dialog/src/use-dialog.js +2 -2
- package/lib/components/dialog/src/use-dialog.js.map +1 -1
- package/lib/components/drawer/index.d.ts +2 -2
- package/lib/components/drawer/src/drawer.vue.d.ts +2 -2
- package/lib/components/dropdown/index.d.ts +1 -1
- package/lib/components/dropdown/src/dropdown.vue.d.ts +1 -1
- package/lib/components/image/index.d.ts +2 -2
- package/lib/components/image/src/image.vue.d.ts +2 -2
- package/lib/components/input/index.d.ts +1 -1
- package/lib/components/input/src/input.vue.d.ts +1 -1
- package/lib/components/input-number/index.d.ts +3 -3
- package/lib/components/input-number/src/input-number.vue.d.ts +3 -3
- package/lib/components/loading/src/service.js +1 -1
- package/lib/components/loading/src/service.js.map +1 -1
- package/lib/components/message/src/message-method.js +1 -1
- package/lib/components/message/src/message-method.js.map +1 -1
- package/lib/components/message-box/src/index.vue_vue_type_script_lang.js +2 -2
- package/lib/components/message-box/src/index.vue_vue_type_script_lang.js.map +1 -1
- package/lib/components/message-box/src/index.vue_vue_type_template_id_7035e868_lang.js.map +1 -1
- package/lib/components/notification/src/notification.vue.d.ts +2 -2
- package/lib/components/notification/src/notify.js +1 -1
- package/lib/components/notification/src/notify.js.map +1 -1
- package/lib/components/overlay/index.d.ts +1 -1
- package/lib/components/overlay/src/overlay.d.ts +1 -1
- package/lib/components/popover/src/usePopover.js +2 -2
- package/lib/components/popover/src/usePopover.js.map +1 -1
- package/lib/components/popper/src/use-popper/index.js +2 -2
- package/lib/components/popper/src/use-popper/index.js.map +1 -1
- package/lib/components/radio/index.d.ts +3 -3
- package/lib/components/radio/src/radio-button.vue.d.ts +1 -1
- package/lib/components/radio/src/radio.d.ts +1 -1
- package/lib/components/radio/src/radio.vue.d.ts +1 -1
- package/lib/components/select/index.d.ts +1 -1
- package/lib/components/select/src/select.vue.d.ts +1 -1
- package/lib/components/select/src/useSelect.d.ts +1 -1
- package/lib/components/select-v2/index.d.ts +2 -2
- package/lib/components/select-v2/src/select.vue.d.ts +1 -1
- package/lib/components/select-v2/src/useSelect.d.ts +1 -1
- package/lib/components/table/index.d.ts +1 -1
- package/lib/components/table/src/table/style-helper.d.ts +1 -1
- package/lib/components/table/src/table.vue.d.ts +1 -1
- package/lib/components/table/src/util.js +1 -1
- package/lib/components/table/src/util.js.map +1 -1
- package/lib/components/teleport/index.d.ts +1 -1
- package/lib/components/teleport/src/teleport.vue.d.ts +1 -1
- package/lib/components/time-picker/index.d.ts +6 -6
- package/lib/components/time-picker/src/common/picker.vue.d.ts +4 -4
- package/lib/components/time-picker/src/common/props.d.ts +1 -1
- package/lib/components/time-picker/src/common/props.js +1 -1
- package/lib/components/time-picker/src/common/props.js.map +1 -1
- package/lib/components/time-picker/src/time-picker.d.ts +3 -3
- package/lib/components/tree/src/model/tree-store.js +1 -1
- package/lib/components/tree/src/model/tree-store.js.map +1 -1
- package/lib/defaults.d.ts +11 -1
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/use-common-props/index.d.ts +1 -1
- package/lib/hooks/use-common-props/index.js +1 -3
- package/lib/hooks/use-common-props/index.js.map +1 -1
- package/lib/hooks/use-global-config/index.d.ts +14 -2
- package/lib/hooks/use-global-config/index.js +25 -2
- package/lib/hooks/use-global-config/index.js.map +1 -1
- package/lib/hooks/use-popper/index.js +2 -2
- package/lib/hooks/use-popper/index.js.map +1 -1
- package/lib/index.d.ts +13 -2
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/make-installer.d.ts +2 -2
- package/lib/make-installer.js +14 -17
- package/lib/make-installer.js.map +1 -1
- package/lib/tokens/config-provider.d.ts +2 -2
- package/lib/tokens/config-provider.js.map +1 -1
- package/lib/utils/popup-manager.d.ts +5 -3
- package/lib/utils/popup-manager.js +21 -25
- package/lib/utils/popup-manager.js.map +1 -1
- package/lib/utils/util.d.ts +2 -8
- package/lib/utils/util.js +17 -13
- package/lib/utils/util.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 +2 -2
- package/theme-chalk/el-button.css +1 -1
- package/theme-chalk/el-cascader-panel.css +1 -1
- package/theme-chalk/el-checkbox-button.css +1 -1
- package/theme-chalk/el-descriptions-item.css +1 -1
- package/theme-chalk/el-descriptions.css +1 -1
- package/theme-chalk/el-form.css +1 -1
- package/theme-chalk/el-input-number.css +1 -1
- package/theme-chalk/el-radio-button.css +1 -1
- package/theme-chalk/el-radio.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/cascader-panel.scss +1 -1
- package/theme-chalk/src/common/var.scss +2 -4
- package/theme-chalk/src/descriptions-item.scss +56 -2
- package/theme-chalk/src/descriptions.scss +75 -27
- package/theme-chalk/src/form.scss +2 -1
- package/theme-chalk/src/input-number.scss +13 -4
- package/theme-chalk/src/radio-button.scss +4 -4
- package/theme-chalk/src/radio.scss +1 -1
- package/web-types.json +1 -1
- package/es/components/config-provider/src/index.d.ts +0 -19
- package/es/components/config-provider/src/index.mjs +0 -22
- package/es/components/config-provider/src/index.mjs.map +0 -1
- package/es/utils/config.d.ts +0 -9
- package/es/utils/config.mjs +0 -10
- package/es/utils/config.mjs.map +0 -1
- package/lib/components/config-provider/src/index.d.ts +0 -19
- package/lib/components/config-provider/src/index.js +0 -26
- package/lib/components/config-provider/src/index.js.map +0 -1
- package/lib/utils/config.d.ts +0 -9
- package/lib/utils/config.js +0 -15
- package/lib/utils/config.js.map +0 -1
package/es/make-installer.mjs
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { watch, unref } from 'vue';
|
|
2
2
|
import './hooks/index.mjs';
|
|
3
|
+
import { isNumber } from './utils/util.mjs';
|
|
4
|
+
import { PopupManager } from './utils/popup-manager.mjs';
|
|
3
5
|
import { version } from './version.mjs';
|
|
4
|
-
import {
|
|
6
|
+
import { provideGlobalConfig } from './hooks/use-global-config/index.mjs';
|
|
5
7
|
|
|
8
|
+
const INSTALLED_KEY = Symbol("INSTALLED_KEY");
|
|
6
9
|
const makeInstaller = (components = []) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const defaultInstallOpt = {
|
|
10
|
-
size: "",
|
|
11
|
-
zIndex: 2e3
|
|
12
|
-
};
|
|
13
|
-
const option = Object.assign(defaultInstallOpt, opts);
|
|
14
|
-
if (apps.includes(app))
|
|
10
|
+
const install = (app, options = {}) => {
|
|
11
|
+
if (app[INSTALLED_KEY])
|
|
15
12
|
return;
|
|
16
|
-
|
|
13
|
+
app[INSTALLED_KEY] = true;
|
|
17
14
|
components.forEach((c) => app.use(c));
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
provideGlobalConfig(options, app);
|
|
16
|
+
watch(() => unref(options).zIndex, () => {
|
|
17
|
+
const zIndex = unref(options).zIndex;
|
|
18
|
+
if (isNumber(zIndex))
|
|
19
|
+
PopupManager.globalInitialZIndex = zIndex;
|
|
20
|
+
}, { immediate: true });
|
|
24
21
|
};
|
|
25
22
|
return {
|
|
26
23
|
version,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-installer.mjs","sources":["../../../packages/element-plus/make-installer.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"make-installer.mjs","sources":["../../../packages/element-plus/make-installer.ts"],"sourcesContent":["import { watch, unref } from 'vue'\nimport { provideGlobalConfig } from '@element-plus/hooks'\nimport { isNumber } from '@element-plus/utils/util'\nimport { PopupManager } from '@element-plus/utils/popup-manager'\nimport { version } from './version'\nimport type { App, Plugin } from 'vue'\nimport type { ConfigProviderContext } from '@element-plus/tokens'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nexport const makeInstaller = (components: Plugin[] = []) => {\n const install = (app: App, options: ConfigProviderContext = {}) => {\n if (app[INSTALLED_KEY]) return\n\n app[INSTALLED_KEY] = true\n components.forEach((c) => app.use(c))\n provideGlobalConfig(options, app)\n\n watch(\n () => unref(options).zIndex,\n () => {\n const zIndex = unref(options).zIndex\n if (isNumber(zIndex)) PopupManager.globalInitialZIndex = zIndex\n },\n { immediate: true }\n )\n }\n\n return {\n version,\n install,\n }\n}\n"],"names":[],"mappings":";;;;;;;AAKA,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAClC,MAAC,aAAa,GAAG,CAAC,UAAU,GAAG,EAAE,KAAK;AAClD,EAAE,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE,KAAK;AACzC,IAAI,IAAI,GAAG,CAAC,aAAa,CAAC;AAC1B,MAAM,OAAO;AACb,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;AAC9B,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,IAAI,mBAAmB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACtC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM;AAC7C,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AAC3C,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC;AAC1B,QAAQ,YAAY,CAAC,mBAAmB,GAAG,MAAM,CAAC;AAClD,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5B,GAAG,CAAC;AACJ,EAAE,OAAO;AACT,IAAI,OAAO;AACX,IAAI,OAAO;AACX,GAAG,CAAC;AACJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { configProviderProps } from 'element-plus/es/components/config-provider';
|
|
2
|
-
import type { InjectionKey, ExtractPropTypes } from 'vue';
|
|
2
|
+
import type { InjectionKey, ExtractPropTypes, Ref } from 'vue';
|
|
3
3
|
export declare type ConfigProviderContext = ExtractPropTypes<typeof configProviderProps>;
|
|
4
|
-
export declare const configProviderContextKey: InjectionKey<ConfigProviderContext
|
|
4
|
+
export declare const configProviderContextKey: InjectionKey<Ref<ConfigProviderContext>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-provider.mjs","sources":["../../../../packages/tokens/config-provider.ts"],"sourcesContent":["import type { configProviderProps } from '@element-plus/components/config-provider'\nimport type { InjectionKey, ExtractPropTypes } from 'vue'\n\nexport type ConfigProviderContext = ExtractPropTypes<typeof configProviderProps>\n\nexport const configProviderContextKey: InjectionKey<ConfigProviderContext>
|
|
1
|
+
{"version":3,"file":"config-provider.mjs","sources":["../../../../packages/tokens/config-provider.ts"],"sourcesContent":["import type { configProviderProps } from '@element-plus/components/config-provider'\nimport type { InjectionKey, ExtractPropTypes, Ref } from 'vue'\n\nexport type ConfigProviderContext = ExtractPropTypes<typeof configProviderProps>\n\nexport const configProviderContextKey: InjectionKey<\n Ref<ConfigProviderContext>\n> = Symbol()\n"],"names":[],"mappings":"AAAY,MAAC,wBAAwB,GAAG,MAAM;;;;"}
|
|
@@ -11,9 +11,11 @@ declare type StackFrame = {
|
|
|
11
11
|
zIndex: number;
|
|
12
12
|
modalClass: string;
|
|
13
13
|
};
|
|
14
|
-
interface
|
|
14
|
+
interface PopupManager {
|
|
15
15
|
getInstance: (id: string) => Instance;
|
|
16
16
|
zIndex: number;
|
|
17
|
+
globalInitialZIndex: number;
|
|
18
|
+
getInitialZIndex: () => number;
|
|
17
19
|
modalDom?: HTMLElement;
|
|
18
20
|
modalFade: boolean;
|
|
19
21
|
modalStack: StackFrame[];
|
|
@@ -24,5 +26,5 @@ interface IPopupManager {
|
|
|
24
26
|
openModal: (id: string, zIndex: number, dom: HTMLElement, modalClass: string, modalFade: boolean) => void;
|
|
25
27
|
closeModal: (id: string) => void;
|
|
26
28
|
}
|
|
27
|
-
declare const PopupManager:
|
|
28
|
-
export
|
|
29
|
+
export declare const PopupManager: PopupManager;
|
|
30
|
+
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { getCurrentInstance } from 'vue';
|
|
1
2
|
import { isClient } from '@vueuse/core';
|
|
2
|
-
import
|
|
3
|
+
import '../hooks/index.mjs';
|
|
3
4
|
import { on, addClass, removeClass } from './dom.mjs';
|
|
4
5
|
import { EVENT_CODE } from './aria.mjs';
|
|
6
|
+
import { useGlobalConfig } from '../hooks/use-global-config/index.mjs';
|
|
5
7
|
|
|
6
8
|
const onTouchMove = (e) => {
|
|
7
9
|
e.preventDefault();
|
|
@@ -11,10 +13,9 @@ const onModalClick = () => {
|
|
|
11
13
|
PopupManager == null ? void 0 : PopupManager.doOnModalClick();
|
|
12
14
|
};
|
|
13
15
|
let hasModal = false;
|
|
14
|
-
let zIndex;
|
|
15
16
|
const getModal = function() {
|
|
16
17
|
if (!isClient)
|
|
17
|
-
return;
|
|
18
|
+
return void 0;
|
|
18
19
|
let modalDom = PopupManager.modalDom;
|
|
19
20
|
if (modalDom) {
|
|
20
21
|
hasModal = true;
|
|
@@ -31,7 +32,14 @@ const instances = {};
|
|
|
31
32
|
const PopupManager = {
|
|
32
33
|
modalFade: true,
|
|
33
34
|
modalDom: void 0,
|
|
34
|
-
|
|
35
|
+
globalInitialZIndex: 2e3,
|
|
36
|
+
zIndex: 0,
|
|
37
|
+
getInitialZIndex() {
|
|
38
|
+
var _a;
|
|
39
|
+
if (!getCurrentInstance())
|
|
40
|
+
return this.globalInitialZIndex;
|
|
41
|
+
return (_a = useGlobalConfig("zIndex").value) != null ? _a : this.globalInitialZIndex;
|
|
42
|
+
},
|
|
35
43
|
getInstance(id) {
|
|
36
44
|
return instances[id];
|
|
37
45
|
},
|
|
@@ -47,7 +55,7 @@ const PopupManager = {
|
|
|
47
55
|
}
|
|
48
56
|
},
|
|
49
57
|
nextZIndex() {
|
|
50
|
-
return ++
|
|
58
|
+
return this.getInitialZIndex() + ++this.zIndex;
|
|
51
59
|
},
|
|
52
60
|
modalStack: [],
|
|
53
61
|
doOnModalClick() {
|
|
@@ -59,10 +67,10 @@ const PopupManager = {
|
|
|
59
67
|
instance.close();
|
|
60
68
|
}
|
|
61
69
|
},
|
|
62
|
-
openModal(id,
|
|
70
|
+
openModal(id, zIndex, dom, modalClass, modalFade) {
|
|
63
71
|
if (!isClient)
|
|
64
72
|
return;
|
|
65
|
-
if (!id ||
|
|
73
|
+
if (!id || zIndex === void 0)
|
|
66
74
|
return;
|
|
67
75
|
this.modalFade = modalFade;
|
|
68
76
|
const modalStack = this.modalStack;
|
|
@@ -89,12 +97,12 @@ const PopupManager = {
|
|
|
89
97
|
} else {
|
|
90
98
|
document.body.appendChild(modalDom);
|
|
91
99
|
}
|
|
92
|
-
if (
|
|
93
|
-
modalDom.style.zIndex = String(
|
|
100
|
+
if (zIndex) {
|
|
101
|
+
modalDom.style.zIndex = String(zIndex);
|
|
94
102
|
}
|
|
95
103
|
modalDom.tabIndex = 0;
|
|
96
104
|
modalDom.style.display = "";
|
|
97
|
-
this.modalStack.push({ id, zIndex
|
|
105
|
+
this.modalStack.push({ id, zIndex, modalClass });
|
|
98
106
|
},
|
|
99
107
|
closeModal(id) {
|
|
100
108
|
const modalStack = this.modalStack;
|
|
@@ -108,7 +116,7 @@ const PopupManager = {
|
|
|
108
116
|
}
|
|
109
117
|
modalStack.pop();
|
|
110
118
|
if (modalStack.length > 0) {
|
|
111
|
-
modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex
|
|
119
|
+
modalDom.style.zIndex = `${modalStack[modalStack.length - 1].zIndex}`;
|
|
112
120
|
}
|
|
113
121
|
} else {
|
|
114
122
|
for (let i = modalStack.length - 1; i >= 0; i--) {
|
|
@@ -135,18 +143,6 @@ const PopupManager = {
|
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
145
|
};
|
|
138
|
-
Object.defineProperty(PopupManager, "zIndex", {
|
|
139
|
-
configurable: true,
|
|
140
|
-
get() {
|
|
141
|
-
if (zIndex === void 0) {
|
|
142
|
-
zIndex = getConfig("zIndex") || 2e3;
|
|
143
|
-
}
|
|
144
|
-
return zIndex;
|
|
145
|
-
},
|
|
146
|
-
set(value) {
|
|
147
|
-
zIndex = value;
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
146
|
const getTopPopup = function() {
|
|
151
147
|
if (!isClient)
|
|
152
148
|
return;
|
|
@@ -159,7 +155,7 @@ const getTopPopup = function() {
|
|
|
159
155
|
}
|
|
160
156
|
};
|
|
161
157
|
if (isClient) {
|
|
162
|
-
|
|
158
|
+
window.addEventListener("keydown", function(event) {
|
|
163
159
|
if (event.code === EVENT_CODE.esc) {
|
|
164
160
|
const topPopup = getTopPopup();
|
|
165
161
|
if (topPopup && topPopup.closeOnPressEscape.value) {
|
|
@@ -169,5 +165,5 @@ if (isClient) {
|
|
|
169
165
|
});
|
|
170
166
|
}
|
|
171
167
|
|
|
172
|
-
export { PopupManager
|
|
168
|
+
export { PopupManager };
|
|
173
169
|
//# sourceMappingURL=popup-manager.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popup-manager.mjs","sources":["../../../../packages/utils/popup-manager.ts"],"sourcesContent":["import { isClient } from '@vueuse/core'\nimport * as configs from './config'\nimport { addClass, removeClass, on } from './dom'\nimport { EVENT_CODE } from './aria'\n\nimport type { Ref } from 'vue'\ninterface Instance {\n closeOnClickModal: Ref<boolean>\n closeOnPressEscape: Ref<boolean>\n close: () => void\n handleClose?: () => void\n handleAction?: (action: string) => void\n}\n\ntype StackFrame = { id: string; zIndex: number; modalClass: string }\n\ninterface IPopupManager {\n getInstance: (id: string) => Instance\n zIndex: number\n modalDom?: HTMLElement\n modalFade: boolean\n modalStack: StackFrame[]\n nextZIndex: () => number\n register: (id: string, instance: Instance) => void\n deregister: (id: string) => void\n doOnModalClick: () => void\n openModal: (\n id: string,\n zIndex: number,\n dom: HTMLElement,\n modalClass: string,\n modalFade: boolean\n ) => void\n closeModal: (id: string) => void\n}\n\nconst onTouchMove = (e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n}\n\nconst onModalClick = () => {\n PopupManager?.doOnModalClick()\n}\n\nlet hasModal = false\nlet zIndex: number\n\nconst getModal = function (): HTMLElement {\n if (!isClient) return\n let modalDom = PopupManager.modalDom\n if (modalDom) {\n hasModal = true\n } else {\n hasModal = false\n modalDom = document.createElement('div')\n PopupManager.modalDom = modalDom\n\n on(modalDom, 'touchmove', onTouchMove)\n on(modalDom, 'click', onModalClick)\n }\n\n return modalDom\n}\n\nconst instances = {}\n\nconst PopupManager: IPopupManager = {\n modalFade: true,\n modalDom: undefined,\n zIndex,\n\n getInstance(id) {\n return instances[id]\n },\n\n register(id, instance) {\n if (id && instance) {\n instances[id] = instance\n }\n },\n\n deregister(id) {\n if (id) {\n instances[id] = null\n delete instances[id]\n }\n },\n\n nextZIndex() {\n return ++PopupManager.zIndex\n },\n\n modalStack: [],\n\n doOnModalClick() {\n const topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1]\n if (!topItem) return\n\n const instance = PopupManager.getInstance(topItem.id)\n if (instance && instance.closeOnClickModal.value) {\n instance.close()\n }\n },\n\n openModal(id, zIndex, dom, modalClass, modalFade) {\n if (!isClient) return\n if (!id || zIndex === undefined) return\n this.modalFade = modalFade\n\n const modalStack = this.modalStack\n\n for (let i = 0, j = modalStack.length; i < j; i++) {\n const item = modalStack[i]\n if (item.id === id) {\n return\n }\n }\n\n const modalDom = getModal()\n\n addClass(modalDom, 'v-modal')\n if (this.modalFade && !hasModal) {\n addClass(modalDom, 'v-modal-enter')\n }\n if (modalClass) {\n const classArr = modalClass.trim().split(/\\s+/)\n classArr.forEach((item) => addClass(modalDom, item))\n }\n setTimeout(() => {\n removeClass(modalDom, 'v-modal-enter')\n }, 200)\n\n if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {\n dom.parentNode.appendChild(modalDom)\n } else {\n document.body.appendChild(modalDom)\n }\n\n if (zIndex) {\n modalDom.style.zIndex = String(zIndex)\n }\n modalDom.tabIndex = 0\n modalDom.style.display = ''\n\n this.modalStack.push({ id, zIndex, modalClass })\n },\n\n closeModal(id) {\n const modalStack = this.modalStack\n const modalDom = getModal()\n\n if (modalStack.length > 0) {\n const topItem = modalStack[modalStack.length - 1]\n if (topItem.id === id) {\n if (topItem.modalClass) {\n const classArr = topItem.modalClass.trim().split(/\\s+/)\n classArr.forEach((item) => removeClass(modalDom, item))\n }\n\n modalStack.pop()\n if (modalStack.length > 0) {\n modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex\n }\n } else {\n for (let i = modalStack.length - 1; i >= 0; i--) {\n if (modalStack[i].id === id) {\n modalStack.splice(i, 1)\n break\n }\n }\n }\n }\n\n if (modalStack.length === 0) {\n if (this.modalFade) {\n addClass(modalDom, 'v-modal-leave')\n }\n setTimeout(() => {\n if (modalStack.length === 0) {\n if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom)\n modalDom.style.display = 'none'\n // off(modalDom, 'touchmove', onTouchMove)\n // off(modalDom, 'click', onModalClick)\n PopupManager.modalDom = undefined\n }\n removeClass(modalDom, 'v-modal-leave')\n }, 200)\n }\n },\n}\n\nObject.defineProperty(PopupManager, 'zIndex', {\n configurable: true,\n get() {\n if (zIndex === undefined) {\n zIndex = (configs.getConfig('zIndex') as number) || 2000\n }\n return zIndex\n },\n set(value) {\n zIndex = value\n },\n})\n\nconst getTopPopup = function () {\n if (!isClient) return\n if (PopupManager.modalStack.length > 0) {\n const topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1]\n if (!topPopup) return\n const instance = PopupManager.getInstance(topPopup.id)\n\n return instance\n }\n}\n\nif (isClient) {\n // handle `esc` key when the popup is shown\n on(window, 'keydown', function (event: KeyboardEvent) {\n if (event.code === EVENT_CODE.esc) {\n const topPopup = getTopPopup()\n\n if (topPopup && topPopup.closeOnPressEscape.value) {\n topPopup.handleClose\n ? topPopup.handleClose()\n : topPopup.handleAction\n ? topPopup.handleAction('cancel')\n : topPopup.close()\n }\n }\n })\n}\n\nexport default PopupManager\n"],"names":["configs.getConfig"],"mappings":";;;;;AAIA,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK;AAC3B,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC;AACrB,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AACtB,CAAC,CAAC;AACF,MAAM,YAAY,GAAG,MAAM;AAC3B,E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AY,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3D,IAAI,OAAO,QAAQ,CAAC;AACpB,GAAG;AACH,CAAC,CAAC;AACF,IAAI,QAAQ,EAAE;AACd,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,KAAK,EAAE;AACxC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,GAAG,EAAE;AACvC,MAAM,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AACrC,MAAM,IAAI,QAAQ,IAAI,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE;AACzD,QAAQ,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnI,OAAO;AACP,KAAK;AACL,GAAG,CAAC,CAAC;AACL;;;;"}
|
|
1
|
+
{"version":3,"file":"popup-manager.mjs","sources":["../../../../packages/utils/popup-manager.ts"],"sourcesContent":["import { getCurrentInstance } from 'vue'\nimport { isClient } from '@vueuse/core'\nimport { useGlobalConfig } from '@element-plus/hooks'\nimport { addClass, removeClass, on } from './dom'\nimport { EVENT_CODE } from './aria'\nimport type { Ref } from 'vue'\n\ninterface Instance {\n closeOnClickModal: Ref<boolean>\n closeOnPressEscape: Ref<boolean>\n close: () => void\n handleClose?: () => void\n handleAction?: (action: string) => void\n}\n\ntype StackFrame = { id: string; zIndex: number; modalClass: string }\n\ninterface PopupManager {\n getInstance: (id: string) => Instance\n zIndex: number\n globalInitialZIndex: number\n getInitialZIndex: () => number\n modalDom?: HTMLElement\n modalFade: boolean\n modalStack: StackFrame[]\n nextZIndex: () => number\n register: (id: string, instance: Instance) => void\n deregister: (id: string) => void\n doOnModalClick: () => void\n openModal: (\n id: string,\n zIndex: number,\n dom: HTMLElement,\n modalClass: string,\n modalFade: boolean\n ) => void\n closeModal: (id: string) => void\n}\n\nconst onTouchMove = (e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n}\n\nconst onModalClick = () => {\n PopupManager?.doOnModalClick()\n}\n\nlet hasModal = false\n\nconst getModal = function (): HTMLElement {\n if (!isClient) return undefined as any\n let modalDom = PopupManager.modalDom\n if (modalDom) {\n hasModal = true\n } else {\n hasModal = false\n modalDom = document.createElement('div')\n PopupManager.modalDom = modalDom\n\n on(modalDom, 'touchmove', onTouchMove)\n on(modalDom, 'click', onModalClick)\n }\n\n return modalDom\n}\n\nconst instances = {}\n\nexport const PopupManager: PopupManager = {\n modalFade: true,\n modalDom: undefined,\n globalInitialZIndex: 2000,\n zIndex: 0,\n\n getInitialZIndex() {\n if (!getCurrentInstance()) return this.globalInitialZIndex\n return useGlobalConfig('zIndex').value ?? this.globalInitialZIndex\n },\n\n getInstance(id) {\n return instances[id]\n },\n\n register(id, instance) {\n if (id && instance) {\n instances[id] = instance\n }\n },\n\n deregister(id) {\n if (id) {\n instances[id] = null\n delete instances[id]\n }\n },\n\n nextZIndex() {\n return this.getInitialZIndex() + ++this.zIndex\n },\n\n modalStack: [],\n\n doOnModalClick() {\n const topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1]\n if (!topItem) return\n\n const instance = PopupManager.getInstance(topItem.id)\n if (instance && instance.closeOnClickModal.value) {\n instance.close()\n }\n },\n\n openModal(id, zIndex, dom, modalClass, modalFade) {\n if (!isClient) return\n if (!id || zIndex === undefined) return\n this.modalFade = modalFade\n\n const modalStack = this.modalStack\n\n for (let i = 0, j = modalStack.length; i < j; i++) {\n const item = modalStack[i]\n if (item.id === id) {\n return\n }\n }\n\n const modalDom = getModal()\n\n addClass(modalDom, 'v-modal')\n if (this.modalFade && !hasModal) {\n addClass(modalDom, 'v-modal-enter')\n }\n if (modalClass) {\n const classArr = modalClass.trim().split(/\\s+/)\n classArr.forEach((item) => addClass(modalDom, item))\n }\n setTimeout(() => {\n removeClass(modalDom, 'v-modal-enter')\n }, 200)\n\n if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {\n dom.parentNode.appendChild(modalDom)\n } else {\n document.body.appendChild(modalDom)\n }\n\n if (zIndex) {\n modalDom.style.zIndex = String(zIndex)\n }\n modalDom.tabIndex = 0\n modalDom.style.display = ''\n\n this.modalStack.push({ id, zIndex, modalClass })\n },\n\n closeModal(id) {\n const modalStack = this.modalStack\n const modalDom = getModal()\n\n if (modalStack.length > 0) {\n const topItem = modalStack[modalStack.length - 1]\n if (topItem.id === id) {\n if (topItem.modalClass) {\n const classArr = topItem.modalClass.trim().split(/\\s+/)\n classArr.forEach((item) => removeClass(modalDom, item))\n }\n\n modalStack.pop()\n if (modalStack.length > 0) {\n modalDom.style.zIndex = `${modalStack[modalStack.length - 1].zIndex}`\n }\n } else {\n for (let i = modalStack.length - 1; i >= 0; i--) {\n if (modalStack[i].id === id) {\n modalStack.splice(i, 1)\n break\n }\n }\n }\n }\n\n if (modalStack.length === 0) {\n if (this.modalFade) {\n addClass(modalDom, 'v-modal-leave')\n }\n setTimeout(() => {\n if (modalStack.length === 0) {\n if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom)\n modalDom.style.display = 'none'\n // off(modalDom, 'touchmove', onTouchMove)\n // off(modalDom, 'click', onModalClick)\n PopupManager.modalDom = undefined\n }\n removeClass(modalDom, 'v-modal-leave')\n }, 200)\n }\n },\n}\n\nconst getTopPopup = function () {\n if (!isClient) return\n if (PopupManager.modalStack.length > 0) {\n const topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1]\n if (!topPopup) return\n const instance = PopupManager.getInstance(topPopup.id)\n\n return instance\n }\n}\n\nif (isClient) {\n // handle `esc` key when the popup is shown\n window.addEventListener('keydown', function (event: KeyboardEvent) {\n if (event.code === EVENT_CODE.esc) {\n const topPopup = getTopPopup()\n\n if (topPopup && topPopup.closeOnPressEscape.value) {\n topPopup.handleClose\n ? topPopup.handleClose()\n : topPopup.handleAction\n ? topPopup.handleAction('cancel')\n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M,GAAG,CAAC,EAAE;AAC1C,IAAI,MAAM,QAAQ,GAAG,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjF,IAAI,IAAI,CAAC,QAAQ;AACjB,MAAM,OAAO;AACb,IAAI,MAAM,QAAQ,GAAG,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3D,IAAI,OAAO,QAAQ,CAAC;AACpB,GAAG;AACH,CAAC,CAAC;AACF,IAAI,QAAQ,EAAE;AACd,EAAE,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,KAAK,EAAE;AACrD,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,GAAG,EAAE;AACvC,MAAM,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AACrC,MAAM,IAAI,QAAQ,IAAI,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE;AACzD,QAAQ,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnI,OAAO;AACP,KAAK;AACL,GAAG,CAAC,CAAC;AACL;;;;"}
|
package/es/utils/util.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { camelize, capitalize, extend, hasOwn, isArray, isObject, isString, looseEqual } from '@vue/shared';
|
|
2
2
|
import type { ComponentPublicInstance, CSSProperties, Ref } from 'vue';
|
|
3
|
-
import type { TimeoutHandle, Nullable
|
|
3
|
+
import type { TimeoutHandle, Nullable } from './types';
|
|
4
4
|
export declare const SCOPE = "Util";
|
|
5
5
|
export declare function toObject<T>(arr: Array<T>): Record<string, T>;
|
|
6
6
|
export declare const getValueByPath: (obj: any, paths?: string) => unknown;
|
|
@@ -32,13 +32,6 @@ export declare const clearTimer: (timer: Ref<TimeoutHandle>) => void;
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function getRandomInt(max: number): number;
|
|
34
34
|
export declare function isUndefined(val: any): val is undefined;
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated please use `useGlobalConfig` in hooks.
|
|
37
|
-
*/
|
|
38
|
-
export declare function useGlobalConfig(): {
|
|
39
|
-
size?: ComponentSize;
|
|
40
|
-
zIndex?: number;
|
|
41
|
-
};
|
|
42
35
|
export declare function isEmpty(val: unknown): boolean;
|
|
43
36
|
export declare function arrayFlat(arr: unknown[]): any;
|
|
44
37
|
export declare function deduplicate<T>(arr: T[]): T[];
|
|
@@ -59,3 +52,4 @@ export declare function isEqualWithFunction(obj: any, other: any): boolean;
|
|
|
59
52
|
* @returns (val: T) => void
|
|
60
53
|
*/
|
|
61
54
|
export declare const refAttacher: <T extends HTMLElement | ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>>>(ref: Ref<T>) => (val: T) => void;
|
|
55
|
+
export declare const merge: <T extends Record<string, any>>(a: T, b: T) => T;
|
package/es/utils/util.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { getCurrentInstance } from 'vue';
|
|
2
|
-
export { isVNode } from 'vue';
|
|
3
1
|
import { extend, hasOwn, hyphenate, toRawType, isArray, isObject, isString, isFunction } from '@vue/shared';
|
|
4
2
|
export { camelize, capitalize, extend, hasOwn, isArray, isObject, isString, looseEqual } from '@vue/shared';
|
|
5
3
|
import isEqualWith from 'lodash/isEqualWith';
|
|
6
4
|
import { isClient } from '@vueuse/core';
|
|
7
5
|
import { throwError, debugWarn } from './error.mjs';
|
|
6
|
+
export { isVNode } from 'vue';
|
|
8
7
|
|
|
9
8
|
const SCOPE = "Util";
|
|
10
9
|
function toObject(arr) {
|
|
@@ -106,13 +105,6 @@ function getRandomInt(max) {
|
|
|
106
105
|
function isUndefined(val) {
|
|
107
106
|
return val === void 0;
|
|
108
107
|
}
|
|
109
|
-
function useGlobalConfig() {
|
|
110
|
-
const vm = getCurrentInstance();
|
|
111
|
-
if ("$ELEMENT" in vm.proxy) {
|
|
112
|
-
return vm.proxy.$ELEMENT;
|
|
113
|
-
}
|
|
114
|
-
return {};
|
|
115
|
-
}
|
|
116
108
|
function isEmpty(val) {
|
|
117
109
|
if (!val && val !== 0 || isArray(val) && !val.length || isObject(val) && !Object.keys(val).length)
|
|
118
110
|
return true;
|
|
@@ -146,6 +138,17 @@ const refAttacher = (ref) => {
|
|
|
146
138
|
ref.value = val;
|
|
147
139
|
};
|
|
148
140
|
};
|
|
141
|
+
const merge = (a, b) => {
|
|
142
|
+
var _a;
|
|
143
|
+
const keys = [
|
|
144
|
+
.../* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])
|
|
145
|
+
];
|
|
146
|
+
const obj = {};
|
|
147
|
+
for (const key of keys) {
|
|
148
|
+
obj[key] = (_a = b[key]) != null ? _a : a[key];
|
|
149
|
+
}
|
|
150
|
+
return obj;
|
|
151
|
+
};
|
|
149
152
|
|
|
150
|
-
export { SCOPE, addUnit, arrayFlat, autoprefixer, clearTimer, coerceTruthyValueToArray, deduplicate, escapeRegexpString, generateId, getPropByPath, getRandomInt, getValueByPath, isBool, isEmpty, isEqualWithFunction, isFirefox, isHTMLElement, isNumber, isUndefined, kebabCase, rafThrottle, refAttacher, toObject
|
|
153
|
+
export { SCOPE, addUnit, arrayFlat, autoprefixer, clearTimer, coerceTruthyValueToArray, deduplicate, escapeRegexpString, generateId, getPropByPath, getRandomInt, getValueByPath, isBool, isEmpty, isEqualWithFunction, isFirefox, isHTMLElement, isNumber, isUndefined, kebabCase, merge, rafThrottle, refAttacher, toObject };
|
|
151
154
|
//# sourceMappingURL=util.mjs.map
|
package/es/utils/util.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.mjs","sources":["../../../../packages/utils/util.ts"],"sourcesContent":["import { getCurrentInstance } from 'vue'\nimport {\n camelize,\n capitalize,\n extend,\n hasOwn,\n hyphenate,\n isArray,\n isObject,\n isString,\n isFunction,\n looseEqual,\n toRawType,\n} from '@vue/shared'\nimport isEqualWith from 'lodash/isEqualWith'\nimport { isClient } from '@vueuse/core'\nimport { debugWarn, throwError } from './error'\n\nimport type { ComponentPublicInstance, CSSProperties, Ref } from 'vue'\nimport type { TimeoutHandle, Nullable, ComponentSize } from './types'\n\nexport const SCOPE = 'Util'\n\nexport function toObject<T>(arr: Array<T>): Record<string, T> {\n const res = {}\n for (let i = 0; i < arr.length; i++) {\n if (arr[i]) {\n extend(res, arr[i])\n }\n }\n return res\n}\n\nexport const getValueByPath = (obj, paths = ''): unknown => {\n let ret: unknown = obj\n paths.split('.').map((path) => {\n ret = ret?.[path]\n })\n return ret\n}\n\nexport function getPropByPath(\n obj: any,\n path: string,\n strict: boolean\n): {\n o: unknown\n k: string\n v: Nullable<unknown>\n} {\n let tempObj = obj\n let key, value\n\n if (obj && hasOwn(obj, path)) {\n key = path\n value = tempObj?.[path]\n } else {\n path = path.replace(/\\[(\\w+)\\]/g, '.$1')\n path = path.replace(/^\\./, '')\n\n const keyArr = path.split('.')\n let i = 0\n for (i; i < keyArr.length - 1; i++) {\n if (!tempObj && !strict) break\n const key = keyArr[i]\n\n if (key in tempObj) {\n tempObj = tempObj[key]\n } else {\n if (strict) {\n throwError(SCOPE, 'Please transfer a valid prop path to form item!')\n }\n break\n }\n }\n key = keyArr[i]\n value = tempObj?.[keyArr[i]]\n }\n return {\n o: tempObj,\n k: key,\n v: value,\n }\n}\n\n/**\n * Generate random number in range [0, 1000]\n * Maybe replace with [uuid](https://www.npmjs.com/package/uuid)\n */\nexport const generateId = (): number => Math.floor(Math.random() * 10000)\n\n// use isEqual instead\n// export const valueEquals\n\nexport const escapeRegexpString = (value = ''): string =>\n String(value).replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n\n// Use native Array.find, Array.findIndex instead\n\n// coerce truthy value to array\nexport const coerceTruthyValueToArray = (arr) => {\n if (!arr && arr !== 0) {\n return []\n }\n return Array.isArray(arr) ? arr : [arr]\n}\n\n// drop IE and (Edge < 79) support\n// export const isIE\n// export const isEdge\n\nexport const isFirefox = function (): boolean {\n return isClient && !!window.navigator.userAgent.match(/firefox/i)\n}\n\nexport const autoprefixer = function (style: CSSProperties): CSSProperties {\n const rules = ['transform', 'transition', 'animation']\n const prefixes = ['ms-', 'webkit-']\n rules.forEach((rule) => {\n const value = style[rule]\n if (rule && value) {\n prefixes.forEach((prefix) => {\n style[prefix + rule] = value\n })\n }\n })\n return style\n}\n\nexport const kebabCase = hyphenate\n\n// reexport from lodash & vue shared\nexport { isVNode } from 'vue'\nexport {\n hasOwn,\n // isEmpty,\n // isEqual,\n isObject,\n isArray,\n isString,\n capitalize,\n camelize,\n looseEqual,\n extend,\n}\n\nexport const isBool = (val: unknown): val is boolean => typeof val === 'boolean'\nexport const isNumber = (val: unknown): val is number => typeof val === 'number'\nexport const isHTMLElement = (val: unknown) => toRawType(val).startsWith('HTML')\n\nexport function rafThrottle<T extends (...args: any) => any>(fn: T): T {\n let locked = false\n return function (this: ThisParameterType<T>, ...args: any[]) {\n if (locked) return\n locked = true\n\n window.requestAnimationFrame(() => {\n Reflect.apply(fn, this, args)\n locked = false\n })\n } as T\n}\n\nexport const clearTimer = (timer: Ref<TimeoutHandle>) => {\n clearTimeout(timer.value)\n timer.value = null\n}\n\n/**\n * Generating a random int in range (0, max - 1)\n * @param max {number}\n */\nexport function getRandomInt(max: number) {\n return Math.floor(Math.random() * Math.floor(max))\n}\n\nexport function isUndefined(val: any): val is undefined {\n return val === undefined\n}\n\n/**\n * @deprecated please use `useGlobalConfig` in hooks.\n */\nexport function useGlobalConfig(): { size?: ComponentSize; zIndex?: number } {\n const vm: any = getCurrentInstance()\n if ('$ELEMENT' in vm.proxy) {\n return vm.proxy.$ELEMENT\n }\n return {}\n}\n\nexport function isEmpty(val: unknown) {\n if (\n (!val && val !== 0) ||\n (isArray(val) && !val.length) ||\n (isObject(val) && !Object.keys(val).length)\n )\n return true\n\n return false\n}\n\nexport function arrayFlat(arr: unknown[]) {\n return arr.reduce((acm: unknown[], item) => {\n const val = Array.isArray(item) ? arrayFlat(item) : item\n return acm.concat(val)\n }, [])\n}\n\nexport function deduplicate<T>(arr: T[]) {\n return Array.from(new Set(arr))\n}\n\nexport function addUnit(value: string | number) {\n if (isString(value)) {\n return value\n } else if (isNumber(value)) {\n return `${value}px`\n }\n debugWarn(SCOPE, 'binding value must be a string or number')\n return ''\n}\n\n/**\n * Enhance `lodash.isEqual` for it always return false even two functions have completely same statements.\n * @param obj The value to compare\n * @param other The other value to compare\n * @returns Returns `true` if the values are equivalent, else `false`.\n * @example\n * lodash.isEqual(() => 1, () => 1) // false\n * isEqualWith(() => 1, () => 1) // true\n */\nexport function isEqualWithFunction(obj: any, other: any) {\n return isEqualWith(obj, other, (objVal, otherVal) => {\n return isFunction(objVal) && isFunction(otherVal)\n ? `${objVal}` === `${otherVal}`\n : undefined\n })\n}\n\n/**\n * Generate function for attach ref for the h renderer\n * @param ref Ref<HTMLElement | ComponentPublicInstance>\n * @returns (val: T) => void\n */\n\nexport const refAttacher = <T extends HTMLElement | ComponentPublicInstance>(\n ref: Ref<T>\n) => {\n return (val: T) => {\n ref.value = val\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAiBY,MAAC,KAAK,GAAG,OAAO;AACrB,SAAS,QAAQ,CAAC,GAAG,EAAE;AAC9B,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC;AACjB,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE;AAChB,MAAM,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1B,KAAK;AACL,GAAG;AACH,EAAE,OAAO,GAA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AG,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AACM,SAAS,WAAW,CAAC,GAAG,EAAE;AACjC,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClC,CAAC;AACM,SAAS,OAAO,CAAC,KAAK,EAAE;AAC/B,EAAE,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;AACvB,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;AAC9B,IAAI,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;AACxB,GAAG;AACH,EAAE,SAAS,CAAC,KAAK,EAAE,0CAA0C,CAAC,CAAC;AAC/D,EAAE,OAAO,EAAE,CAAC;AACZ,CAAC;AACM,SAAS,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE;AAChD,EAAE,OAAO,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK;AACvD,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;AAC/F,GAAG,CAAC,CAAC;AACL,CAAC;AACW,MAAC,WAAW,GAAG,CAAC,GAAG,KAAK;AACpC,EAAE,OAAO,CAAC,GAAG,KAAK;AAClB,IAAI,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC;AACpB,GAAG,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"util.mjs","sources":["../../../../packages/utils/util.ts"],"sourcesContent":["import {\n camelize,\n capitalize,\n extend,\n hasOwn,\n hyphenate,\n isArray,\n isObject,\n isString,\n isFunction,\n looseEqual,\n toRawType,\n} from '@vue/shared'\nimport isEqualWith from 'lodash/isEqualWith'\nimport { isClient } from '@vueuse/core'\nimport { debugWarn, throwError } from './error'\n\nimport type { ComponentPublicInstance, CSSProperties, Ref } from 'vue'\nimport type { TimeoutHandle, Nullable } from './types'\n\nexport const SCOPE = 'Util'\n\nexport function toObject<T>(arr: Array<T>): Record<string, T> {\n const res = {}\n for (let i = 0; i < arr.length; i++) {\n if (arr[i]) {\n extend(res, arr[i])\n }\n }\n return res\n}\n\nexport const getValueByPath = (obj, paths = ''): unknown => {\n let ret: unknown = obj\n paths.split('.').map((path) => {\n ret = ret?.[path]\n })\n return ret\n}\n\nexport function getPropByPath(\n obj: any,\n path: string,\n strict: boolean\n): {\n o: unknown\n k: string\n v: Nullable<unknown>\n} {\n let tempObj = obj\n let key, value\n\n if (obj && hasOwn(obj, path)) {\n key = path\n value = tempObj?.[path]\n } else {\n path = path.replace(/\\[(\\w+)\\]/g, '.$1')\n path = path.replace(/^\\./, '')\n\n const keyArr = path.split('.')\n let i = 0\n for (i; i < keyArr.length - 1; i++) {\n if (!tempObj && !strict) break\n const key = keyArr[i]\n\n if (key in tempObj) {\n tempObj = tempObj[key]\n } else {\n if (strict) {\n throwError(SCOPE, 'Please transfer a valid prop path to form item!')\n }\n break\n }\n }\n key = keyArr[i]\n value = tempObj?.[keyArr[i]]\n }\n return {\n o: tempObj,\n k: key,\n v: value,\n }\n}\n\n/**\n * Generate random number in range [0, 1000]\n * Maybe replace with [uuid](https://www.npmjs.com/package/uuid)\n */\nexport const generateId = (): number => Math.floor(Math.random() * 10000)\n\n// use isEqual instead\n// export const valueEquals\n\nexport const escapeRegexpString = (value = ''): string =>\n String(value).replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n\n// Use native Array.find, Array.findIndex instead\n\n// coerce truthy value to array\nexport const coerceTruthyValueToArray = (arr) => {\n if (!arr && arr !== 0) {\n return []\n }\n return Array.isArray(arr) ? arr : [arr]\n}\n\n// drop IE and (Edge < 79) support\n// export const isIE\n// export const isEdge\n\nexport const isFirefox = function (): boolean {\n return isClient && !!window.navigator.userAgent.match(/firefox/i)\n}\n\nexport const autoprefixer = function (style: CSSProperties): CSSProperties {\n const rules = ['transform', 'transition', 'animation']\n const prefixes = ['ms-', 'webkit-']\n rules.forEach((rule) => {\n const value = style[rule]\n if (rule && value) {\n prefixes.forEach((prefix) => {\n style[prefix + rule] = value\n })\n }\n })\n return style\n}\n\nexport const kebabCase = hyphenate\n\n// reexport from lodash & vue shared\nexport { isVNode } from 'vue'\nexport {\n hasOwn,\n // isEmpty,\n // isEqual,\n isObject,\n isArray,\n isString,\n capitalize,\n camelize,\n looseEqual,\n extend,\n}\n\nexport const isBool = (val: unknown): val is boolean => typeof val === 'boolean'\nexport const isNumber = (val: unknown): val is number => typeof val === 'number'\nexport const isHTMLElement = (val: unknown) => toRawType(val).startsWith('HTML')\n\nexport function rafThrottle<T extends (...args: any) => any>(fn: T): T {\n let locked = false\n return function (this: ThisParameterType<T>, ...args: any[]) {\n if (locked) return\n locked = true\n\n window.requestAnimationFrame(() => {\n Reflect.apply(fn, this, args)\n locked = false\n })\n } as T\n}\n\nexport const clearTimer = (timer: Ref<TimeoutHandle>) => {\n clearTimeout(timer.value)\n timer.value = null\n}\n\n/**\n * Generating a random int in range (0, max - 1)\n * @param max {number}\n */\nexport function getRandomInt(max: number) {\n return Math.floor(Math.random() * Math.floor(max))\n}\n\nexport function isUndefined(val: any): val is undefined {\n return val === undefined\n}\n\nexport function isEmpty(val: unknown) {\n if (\n (!val && val !== 0) ||\n (isArray(val) && !val.length) ||\n (isObject(val) && !Object.keys(val).length)\n )\n return true\n\n return false\n}\n\nexport function arrayFlat(arr: unknown[]) {\n return arr.reduce((acm: unknown[], item) => {\n const val = Array.isArray(item) ? arrayFlat(item) : item\n return acm.concat(val)\n }, [])\n}\n\nexport function deduplicate<T>(arr: T[]) {\n return Array.from(new Set(arr))\n}\n\nexport function addUnit(value: string | number) {\n if (isString(value)) {\n return value\n } else if (isNumber(value)) {\n return `${value}px`\n }\n debugWarn(SCOPE, 'binding value must be a string or number')\n return ''\n}\n\n/**\n * Enhance `lodash.isEqual` for it always return false even two functions have completely same statements.\n * @param obj The value to compare\n * @param other The other value to compare\n * @returns Returns `true` if the values are equivalent, else `false`.\n * @example\n * lodash.isEqual(() => 1, () => 1) // false\n * isEqualWith(() => 1, () => 1) // true\n */\nexport function isEqualWithFunction(obj: any, other: any) {\n return isEqualWith(obj, other, (objVal, otherVal) => {\n return isFunction(objVal) && isFunction(otherVal)\n ? `${objVal}` === `${otherVal}`\n : undefined\n })\n}\n\n/**\n * Generate function for attach ref for the h renderer\n * @param ref Ref<HTMLElement | ComponentPublicInstance>\n * @returns (val: T) => void\n */\n\nexport const refAttacher = <T extends HTMLElement | ComponentPublicInstance>(\n ref: Ref<T>\n) => {\n return (val: T) => {\n ref.value = val\n }\n}\n\nexport const merge = <T extends Record<string, any>>(a: T, b: T) => {\n const keys = [\n ...new Set([...Object.keys(a), ...Object.keys(b)]),\n ] as (keyof T)[]\n const obj = {} as T\n for (const key of keys) {\n obj[key] = b[key] ?? a[key]\n }\n return obj\n}\n"],"names":[],"mappings":";;;;;;;AAgBY,MAAC,KAAK,GAAG,OAAO;AACrB,SAAS,QAAQ,CAAC,GAAG,EAAE;AAC9B,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC;AACjB,EAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE;AAChB,MAAM,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1B,KAAK;AACL,GAAG;AACH,EAAE,OAAO,GAAG,CAAC;AACb,CAAC;AACW,MAAC,cAAc,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,EAAE,KAAK;AACnD,EAAE,IAAI,GAAG,GAAG,GAAG,CAAC;AAChB,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAA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version = "0.0.20220103";
|
package/es/version.mjs
CHANGED
package/es/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../packages/element-plus/version.ts"],"sourcesContent":["export const version = '0.0.20220103'\n"],"names":[],"mappings":"AAAY,MAAC,OAAO,GAAG;;;;"}
|
package/global.d.ts
CHANGED
|
@@ -94,4 +94,17 @@ declare module 'vue' {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
declare module '@vue/runtime-core' {
|
|
98
|
+
interface ComponentCustomProperties {
|
|
99
|
+
$message: typeof import('element-plus')['ElMessage']
|
|
100
|
+
$notify: typeof import('element-plus')['ElNotification']
|
|
101
|
+
$msgbox: typeof import('element-plus')['ElMessageBox']
|
|
102
|
+
$messageBox: typeof import('element-plus')['ElMessageBox']
|
|
103
|
+
$alert: typeof import('element-plus')['ElMessageBox']['alert']
|
|
104
|
+
$confirm: typeof import('element-plus')['ElMessageBox']['confirm']
|
|
105
|
+
$prompt: typeof import('element-plus')['ElMessageBox']['prompt']
|
|
106
|
+
$loading: typeof import('element-plus')['ElLoadingService']
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
97
110
|
export {}
|
|
@@ -14,7 +14,7 @@ export declare const ElButton: import("../../utils/types").SFCWithInstall<import
|
|
|
14
14
|
}, {
|
|
15
15
|
buttonRef: import("vue").Ref<any>;
|
|
16
16
|
buttonStyle: import("vue").ComputedRef<{}>;
|
|
17
|
-
buttonSize: import("vue").ComputedRef<
|
|
17
|
+
buttonSize: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
|
|
18
18
|
buttonType: import("vue").ComputedRef<"" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text">;
|
|
19
19
|
buttonDisabled: import("vue").ComputedRef<boolean>;
|
|
20
20
|
shouldAddSpace: import("vue").ComputedRef<boolean>;
|
|
@@ -14,7 +14,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
14
14
|
}, {
|
|
15
15
|
buttonRef: import("vue").Ref<any>;
|
|
16
16
|
buttonStyle: import("vue").ComputedRef<{}>;
|
|
17
|
-
buttonSize: import("vue").ComputedRef<
|
|
17
|
+
buttonSize: import("vue").ComputedRef<import("../../../utils/types").ComponentSize>;
|
|
18
18
|
buttonType: import("vue").ComputedRef<"" | "default" | "primary" | "success" | "warning" | "info" | "danger" | "text">;
|
|
19
19
|
buttonDisabled: import("vue").ComputedRef<boolean>;
|
|
20
20
|
shouldAddSpace: import("vue").ComputedRef<boolean>;
|
|
@@ -3569,7 +3569,7 @@ declare const _Cascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3569
3569
|
input: import("vue").Ref<HTMLInputElement | undefined>;
|
|
3570
3570
|
textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
|
|
3571
3571
|
attrs: import("vue").ComputedRef<Record<string, unknown>>;
|
|
3572
|
-
inputSize: import("vue").ComputedRef<
|
|
3572
|
+
inputSize: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
|
|
3573
3573
|
validateState: import("vue").ComputedRef<string>;
|
|
3574
3574
|
validateIcon: import("vue").ComputedRef<any>;
|
|
3575
3575
|
containerStyle: import("vue").ComputedRef<import("element-plus/es/utils/types").StyleValue>;
|
|
@@ -3717,7 +3717,7 @@ declare const _Cascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3717
3717
|
input: import("vue").Ref<HTMLInputElement | undefined>;
|
|
3718
3718
|
textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
|
|
3719
3719
|
attrs: import("vue").ComputedRef<Record<string, unknown>>;
|
|
3720
|
-
inputSize: import("vue").ComputedRef<
|
|
3720
|
+
inputSize: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
|
|
3721
3721
|
validateState: import("vue").ComputedRef<string>;
|
|
3722
3722
|
validateIcon: import("vue").ComputedRef<any>;
|
|
3723
3723
|
containerStyle: import("vue").ComputedRef<import("element-plus/es/utils/types").StyleValue>;
|
|
@@ -4299,7 +4299,7 @@ declare const _Cascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
4299
4299
|
suggestions: import("vue").Ref<import("../cascader-panel/src/node").default[]>;
|
|
4300
4300
|
isDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
4301
4301
|
isOnComposition: import("vue").Ref<boolean>;
|
|
4302
|
-
realSize: import("vue").ComputedRef<
|
|
4302
|
+
realSize: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
|
|
4303
4303
|
tagSize: import("vue").ComputedRef<"default" | "small">;
|
|
4304
4304
|
multiple: import("vue").ComputedRef<boolean>;
|
|
4305
4305
|
readonly: import("vue").ComputedRef<boolean>;
|
|
@@ -7947,7 +7947,7 @@ export declare const ElCascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
7947
7947
|
input: import("vue").Ref<HTMLInputElement | undefined>;
|
|
7948
7948
|
textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
|
|
7949
7949
|
attrs: import("vue").ComputedRef<Record<string, unknown>>;
|
|
7950
|
-
inputSize: import("vue").ComputedRef<
|
|
7950
|
+
inputSize: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
|
|
7951
7951
|
validateState: import("vue").ComputedRef<string>;
|
|
7952
7952
|
validateIcon: import("vue").ComputedRef<any>;
|
|
7953
7953
|
containerStyle: import("vue").ComputedRef<import("element-plus/es/utils/types").StyleValue>;
|
|
@@ -8095,7 +8095,7 @@ export declare const ElCascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
8095
8095
|
input: import("vue").Ref<HTMLInputElement | undefined>;
|
|
8096
8096
|
textarea: import("vue").Ref<HTMLTextAreaElement | undefined>;
|
|
8097
8097
|
attrs: import("vue").ComputedRef<Record<string, unknown>>;
|
|
8098
|
-
inputSize: import("vue").ComputedRef<
|
|
8098
|
+
inputSize: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
|
|
8099
8099
|
validateState: import("vue").ComputedRef<string>;
|
|
8100
8100
|
validateIcon: import("vue").ComputedRef<any>;
|
|
8101
8101
|
containerStyle: import("vue").ComputedRef<import("element-plus/es/utils/types").StyleValue>;
|
|
@@ -8677,7 +8677,7 @@ export declare const ElCascader: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
8677
8677
|
suggestions: import("vue").Ref<import("../cascader-panel/src/node").default[]>;
|
|
8678
8678
|
isDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
8679
8679
|
isOnComposition: import("vue").Ref<boolean>;
|
|
8680
|
-
realSize: import("vue").ComputedRef<
|
|
8680
|
+
realSize: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
|
|
8681
8681
|
tagSize: import("vue").ComputedRef<"default" | "small">;
|
|
8682
8682
|
multiple: import("vue").ComputedRef<boolean>;
|
|
8683
8683
|
readonly: import("vue").ComputedRef<boolean>;
|
|
@@ -3574,7 +3574,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3574
3574
|
input: Ref<HTMLInputElement | undefined>;
|
|
3575
3575
|
textarea: Ref<HTMLTextAreaElement | undefined>;
|
|
3576
3576
|
attrs: ComputedRef<Record<string, unknown>>;
|
|
3577
|
-
inputSize: ComputedRef<
|
|
3577
|
+
inputSize: ComputedRef<ComponentSize>;
|
|
3578
3578
|
validateState: ComputedRef<string>;
|
|
3579
3579
|
validateIcon: ComputedRef<any>;
|
|
3580
3580
|
containerStyle: ComputedRef<import("element-plus/es/utils/types").StyleValue>;
|
|
@@ -3722,7 +3722,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3722
3722
|
input: Ref<HTMLInputElement | undefined>;
|
|
3723
3723
|
textarea: Ref<HTMLTextAreaElement | undefined>;
|
|
3724
3724
|
attrs: ComputedRef<Record<string, unknown>>;
|
|
3725
|
-
inputSize: ComputedRef<
|
|
3725
|
+
inputSize: ComputedRef<ComponentSize>;
|
|
3726
3726
|
validateState: ComputedRef<string>;
|
|
3727
3727
|
validateIcon: ComputedRef<any>;
|
|
3728
3728
|
containerStyle: ComputedRef<import("element-plus/es/utils/types").StyleValue>;
|
|
@@ -4304,7 +4304,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
4304
4304
|
suggestions: Ref<CascaderNode[]>;
|
|
4305
4305
|
isDisabled: ComputedRef<boolean | undefined>;
|
|
4306
4306
|
isOnComposition: Ref<boolean>;
|
|
4307
|
-
realSize: ComputedRef<
|
|
4307
|
+
realSize: ComputedRef<ComponentSize>;
|
|
4308
4308
|
tagSize: ComputedRef<"default" | "small">;
|
|
4309
4309
|
multiple: ComputedRef<boolean>;
|
|
4310
4310
|
readonly: ComputedRef<boolean>;
|
|
@@ -38,11 +38,11 @@ export declare const ElCheckbox: import("../../utils/types").SFCWithInstall<impo
|
|
|
38
38
|
}, {
|
|
39
39
|
isChecked: import("vue").ComputedRef<boolean>;
|
|
40
40
|
isDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
41
|
-
checkboxSize: import("vue").ComputedRef<
|
|
41
|
+
checkboxSize: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
|
|
42
42
|
model: import("vue").WritableComputedRef<any>;
|
|
43
43
|
handleChange: (e: InputEvent) => void;
|
|
44
44
|
focus: import("vue").Ref<boolean>;
|
|
45
|
-
size: import("vue").ComputedRef<
|
|
45
|
+
size: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
|
|
46
46
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
47
47
|
modelValue?: unknown;
|
|
48
48
|
label?: unknown;
|
|
@@ -124,7 +124,7 @@ export declare const ElCheckbox: import("../../utils/types").SFCWithInstall<impo
|
|
|
124
124
|
color: string;
|
|
125
125
|
boxShadow: string | null;
|
|
126
126
|
}>;
|
|
127
|
-
size: import("vue").ComputedRef<
|
|
127
|
+
size: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
|
|
128
128
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
129
129
|
modelValue?: unknown;
|
|
130
130
|
label?: unknown;
|
|
@@ -262,7 +262,7 @@ export declare const ElCheckboxButton: import("../../utils/types").SFCWithInstal
|
|
|
262
262
|
color: string;
|
|
263
263
|
boxShadow: string | null;
|
|
264
264
|
}>;
|
|
265
|
-
size: import("vue").ComputedRef<
|
|
265
|
+
size: import("vue").ComputedRef<import("../../utils/types").ComponentSize>;
|
|
266
266
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
267
267
|
modelValue?: unknown;
|
|
268
268
|
label?: unknown;
|
|
@@ -35,7 +35,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
35
35
|
color: string;
|
|
36
36
|
boxShadow: string | null;
|
|
37
37
|
}>;
|
|
38
|
-
size: import("vue").ComputedRef<
|
|
38
|
+
size: import("vue").ComputedRef<import("../../../utils/types").ComponentSize>;
|
|
39
39
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
40
40
|
modelValue?: unknown;
|
|
41
41
|
label?: unknown;
|
|
@@ -40,11 +40,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
40
40
|
}, {
|
|
41
41
|
isChecked: import("vue").ComputedRef<boolean>;
|
|
42
42
|
isDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
43
|
-
checkboxSize: import("vue").ComputedRef<
|
|
43
|
+
checkboxSize: import("vue").ComputedRef<ComponentSize>;
|
|
44
44
|
model: import("vue").WritableComputedRef<any>;
|
|
45
45
|
handleChange: (e: InputEvent) => void;
|
|
46
46
|
focus: import("vue").Ref<boolean>;
|
|
47
|
-
size: import("vue").ComputedRef<
|
|
47
|
+
size: import("vue").ComputedRef<ComponentSize>;
|
|
48
48
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "change")[], "update:modelValue" | "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
49
49
|
modelValue?: unknown;
|
|
50
50
|
label?: unknown;
|
|
@@ -38,9 +38,9 @@ export declare const useCheckboxGroup: () => {
|
|
|
38
38
|
export declare const useCheckbox: (props: IUseCheckboxProps) => {
|
|
39
39
|
isChecked: import("vue").ComputedRef<boolean>;
|
|
40
40
|
isDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
41
|
-
checkboxSize: import("vue").ComputedRef<
|
|
41
|
+
checkboxSize: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
|
|
42
42
|
model: import("vue").WritableComputedRef<any>;
|
|
43
43
|
handleChange: (e: InputEvent) => void;
|
|
44
44
|
focus: import("vue").Ref<boolean>;
|
|
45
|
-
size: import("vue").ComputedRef<
|
|
45
|
+
size: import("vue").ComputedRef<import("element-plus/es/utils/types").ComponentSize>;
|
|
46
46
|
};
|