easy-elplus 1.1.1 → 1.2.0

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.
Files changed (26) hide show
  1. package/README.md +2 -1
  2. package/dist/index.full.js +22 -23
  3. package/es/packages/components/button/src/button.vue.mjs +1 -1
  4. package/es/packages/components/descriptions/src/comp.vue.mjs +17 -10
  5. package/es/packages/components/descriptions/src/descriptions.vue.mjs +1 -1
  6. package/es/packages/components/dialog/src/useDialog.mjs +1 -2
  7. package/es/packages/components/table/src/table.vue.mjs +1 -2
  8. package/es/packages/hooks/src/useDynamicComponent.mjs +1 -2
  9. package/es/packages/utils/type.mjs +6 -2
  10. package/lib/packages/components/button/src/button.vue.js +2 -2
  11. package/lib/packages/components/descriptions/src/comp.vue.js +16 -9
  12. package/lib/packages/components/descriptions/src/descriptions.vue.js +5 -5
  13. package/lib/packages/components/dialog/src/useDialog.js +5 -6
  14. package/lib/packages/components/table/src/table.vue.js +3 -4
  15. package/lib/packages/hooks/src/useDynamicComponent.js +1 -2
  16. package/lib/packages/utils/type.js +7 -1
  17. package/package.json +5 -5
  18. package/es/node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.mjs +0 -13
  19. package/es/packages/components/dialog/src/appContext.mjs +0 -25
  20. package/es/packages/components/dialog/src/dialog.mjs +0 -130
  21. package/es/packages/components/table/src/tableColumn.vue.mjs +0 -72
  22. package/lib/node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.js +0 -16
  23. package/lib/packages/components/dialog/src/appContext.js +0 -28
  24. package/lib/packages/components/dialog/src/dialog.js +0 -132
  25. package/lib/packages/components/table/src/tableColumn.vue.js +0 -76
  26. package/public/qq.jpg +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 技术交流群 711368818
4
4
 
5
- <img src="./public/qq.jpg" width="200" />
5
+ <img src="https://raw.githubusercontent.com/jiayc4215/easy-elplus/master/public/qq.jpg" width="200" />
6
6
 
7
7
  ## Introduction
8
8
 
@@ -63,6 +63,7 @@ const handleAsync = async () => {
63
63
 
64
64
  - [组件文档](https://jiayc4215.github.io/easy-elplus/)
65
65
  - [vue3表单渲染器](https://jiayc4215.github.io/form-render/)
66
+ - [vue3扩展指令](https://github.com/jiayc4215/directives-expand/)
66
67
 
67
68
  ## Inspiration
68
69
 
@@ -4,17 +4,13 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.EasyElPlus = {}, global.Vue, global.ElementPlus, global.ElementPlusIconsVue));
5
5
  })(this, (function (exports, vue, elementPlus, iconsVue) { 'use strict';
6
6
 
7
- /**
8
- * @vue/shared v3.5.27
9
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
10
- * @license MIT
11
- **/
12
-
7
+ const isUndefined = val => typeof val === "undefined";
8
+ const isNumber = val => typeof val === "number" && !Number.isNaN(val);
13
9
 
14
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
15
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
16
- const isFunction$1 = (val) => typeof val === "function";
17
- const isObject$1 = (val) => val !== null && typeof val === "object";
10
+ // === vue shared ===
11
+ const isString = val => typeof val === "string";
12
+ const isFunction$1 = val => typeof val === "function";
13
+ const isObject$1 = val => val !== null && typeof val === "object";
18
14
 
19
15
  /**
20
16
  * 给组件添加 install 方法,支持主组件 + 附加组件
@@ -61,10 +57,6 @@
61
57
  return globalAppContext
62
58
  }
63
59
 
64
- const isUndefined = val => typeof val === "undefined";
65
- const isNumber = val => typeof val === "number";
66
- const isString = val => typeof val === "string";
67
-
68
60
  /** Detect free variable `global` from Node.js. */
69
61
  var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
70
62
 
@@ -2967,21 +2959,28 @@
2967
2959
 
2968
2960
 
2969
2961
 
2970
-
2962
+ const componentProps = __props;
2971
2963
 
2972
2964
  const descriptionsData = vue.useModel(__props, "modelValue");
2973
-
2974
2965
  const { getComponent } = useDynamicComponent();
2975
2966
 
2967
+ // 1. 动态计算要渲染的组件
2968
+ const currentComponent = vue.computed(() => {
2969
+ return componentProps.id
2970
+ ? getComponent(componentProps.components, descriptionsData.value)
2971
+ : getComponent(componentProps.components)
2972
+ });
2973
+
2974
+ // 2. 动态构建 Model 绑定 (仅在有 id 时绑定)
2975
+ const dynamicModel = vue.computed(() => {
2976
+ return componentProps.id ? { modelValue: descriptionsData.value[componentProps.id] } : {}
2977
+ });
2978
+
2976
2979
  return (_ctx, _cache) => {
2977
2980
  return vue.renderSlot(_ctx.$slots, __props.components, {}, () => [
2978
- (__props.id)
2979
- ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(getComponent)(__props.components, descriptionsData.value)), vue.mergeProps({
2980
- key: 0,
2981
- modelValue: descriptionsData.value[__props.id],
2982
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((descriptionsData.value[__props.id]) = $event))
2983
- }, __props.props), null, 16 /* FULL_PROPS */, ["modelValue"]))
2984
- : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(getComponent)(__props.components)), vue.normalizeProps(vue.mergeProps({ key: 1 }, __props.props)), null, 16 /* FULL_PROPS */))
2981
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(currentComponent.value), vue.mergeProps({ ...dynamicModel.value, ...__props.props }, {
2982
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = val => __props.id && (descriptionsData.value[__props.id] = val))
2983
+ }), null, 16 /* FULL_PROPS */))
2985
2984
  ])
2986
2985
  }
2987
2986
  }
@@ -1,6 +1,6 @@
1
1
  import { ref, useAttrs, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
2
2
  import { ElButton } from 'element-plus';
3
- import { isFunction } from '../../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.mjs';
3
+ import { isFunction } from '../../../utils/type.mjs';
4
4
  import omit from '../../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/omit.mjs';
5
5
 
6
6
  const _sfc_main = /*@__PURE__*/Object.assign({
@@ -1,4 +1,4 @@
1
- import { useModel, renderSlot, openBlock, createBlock, resolveDynamicComponent, unref, mergeProps, normalizeProps, mergeModels } from 'vue';
1
+ import { useModel, computed, renderSlot, openBlock, createBlock, resolveDynamicComponent, mergeProps, mergeModels } from 'vue';
2
2
  import { useDynamicComponent } from '../../../hooks/src/useDynamicComponent.mjs';
3
3
 
4
4
  const _sfc_main = /*@__PURE__*/Object.assign({
@@ -27,21 +27,28 @@ const _sfc_main = /*@__PURE__*/Object.assign({
27
27
 
28
28
 
29
29
 
30
-
30
+ const componentProps = __props;
31
31
 
32
32
  const descriptionsData = useModel(__props, "modelValue");
33
-
34
33
  const { getComponent } = useDynamicComponent();
35
34
 
35
+ // 1. 动态计算要渲染的组件
36
+ const currentComponent = computed(() => {
37
+ return componentProps.id
38
+ ? getComponent(componentProps.components, descriptionsData.value)
39
+ : getComponent(componentProps.components)
40
+ });
41
+
42
+ // 2. 动态构建 Model 绑定 (仅在有 id 时绑定)
43
+ const dynamicModel = computed(() => {
44
+ return componentProps.id ? { modelValue: descriptionsData.value[componentProps.id] } : {}
45
+ });
46
+
36
47
  return (_ctx, _cache) => {
37
48
  return renderSlot(_ctx.$slots, __props.components, {}, () => [
38
- (__props.id)
39
- ? (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(__props.components, descriptionsData.value)), mergeProps({
40
- key: 0,
41
- modelValue: descriptionsData.value[__props.id],
42
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((descriptionsData.value[__props.id]) = $event))
43
- }, __props.props), null, 16 /* FULL_PROPS */, ["modelValue"]))
44
- : (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(__props.components)), normalizeProps(mergeProps({ key: 1 }, __props.props)), null, 16 /* FULL_PROPS */))
49
+ (openBlock(), createBlock(resolveDynamicComponent(currentComponent.value), mergeProps({ ...dynamicModel.value, ...__props.props }, {
50
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = val => __props.id && (descriptionsData.value[__props.id] = val))
51
+ }), null, 16 /* FULL_PROPS */))
45
52
  ])
46
53
  }
47
54
  }
@@ -1,6 +1,6 @@
1
1
  import { useModel, computed, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, mergeProps, createSlots, withCtx, resolveDynamicComponent, h, createTextVNode, toDisplayString, renderSlot, mergeModels } from 'vue';
2
2
  import { ElDescriptions, ElDescriptionsItem } from 'element-plus';
3
- import { isFunction, isObject } from '../../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.mjs';
3
+ import { isFunction, isObject } from '../../../utils/type.mjs';
4
4
  import _sfc_main$1 from './comp.vue.mjs';
5
5
 
6
6
  const _hoisted_1 = { class: "epl-descriptions" };
@@ -1,8 +1,7 @@
1
1
  import { markRaw, ref, createApp, h } from 'vue';
2
2
  import { ElDialog, ElButton } from 'element-plus';
3
- import { isFunction } from '../../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.mjs';
3
+ import { isString, isFunction } from '../../../utils/type.mjs';
4
4
  import { getGlobalAppContext } from '../../../utils/vue/appContext.mjs';
5
- import { isString } from '../../../utils/type.mjs';
6
5
 
7
6
  /**
8
7
  *
@@ -1,8 +1,7 @@
1
1
  import { useSlots, ref, watch, computed, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, createSlots, renderSlot, createCommentVNode, unref, resolveDynamicComponent, toDisplayString, withModifiers, createTextVNode, normalizeStyle } from 'vue';
2
2
  import { MoreFilled } from '@element-plus/icons-vue';
3
3
  import { scrollTo } from './scrollTo.mjs';
4
- import { isFunction } from '../../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.mjs';
5
- import { isString } from '../../../utils/type.mjs';
4
+ import { isString, isFunction } from '../../../utils/type.mjs';
6
5
  import './table.vue2.mjs';
7
6
  import _export_sfc from '../../../../_virtual/_plugin-vue_export-helper.mjs';
8
7
 
@@ -1,6 +1,5 @@
1
1
  import { resolveComponent, h } from 'vue';
2
- import { isFunction } from '../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.mjs';
3
- import { isString, isNumber } from '../../utils/type.mjs';
2
+ import { isString, isNumber, isFunction } from '../../utils/type.mjs';
4
3
 
5
4
  function useDynamicComponent() {
6
5
  /**
@@ -1,5 +1,9 @@
1
1
  const isUndefined = val => typeof val === "undefined";
2
- const isNumber = val => typeof val === "number";
2
+ const isNumber = val => typeof val === "number" && !Number.isNaN(val);
3
+
4
+ // === vue shared ===
3
5
  const isString = val => typeof val === "string";
6
+ const isFunction = val => typeof val === "function";
7
+ const isObject = val => val !== null && typeof val === "object";
4
8
 
5
- export { isNumber, isString, isUndefined };
9
+ export { isFunction, isNumber, isObject, isString, isUndefined };
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vue = require('vue');
6
6
  var elementPlus = require('element-plus');
7
- var shared_esmBundler = require('../../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.js');
7
+ var type = require('../../../utils/type.js');
8
8
  var omit = require('../../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/omit.js');
9
9
 
10
10
  const _sfc_main = /*@__PURE__*/Object.assign({
@@ -23,7 +23,7 @@ const onClick = async () => {
23
23
  try {
24
24
  loading.value = true;
25
25
 
26
- if (shared_esmBundler.isFunction(attrs.onClick)) {
26
+ if (type.isFunction(attrs.onClick)) {
27
27
  await attrs.onClick();
28
28
  }
29
29
  } finally {
@@ -31,21 +31,28 @@ const _sfc_main = /*@__PURE__*/Object.assign({
31
31
 
32
32
 
33
33
 
34
-
34
+ const componentProps = __props;
35
35
 
36
36
  const descriptionsData = vue.useModel(__props, "modelValue");
37
-
38
37
  const { getComponent } = useDynamicComponent.useDynamicComponent();
39
38
 
39
+ // 1. 动态计算要渲染的组件
40
+ const currentComponent = vue.computed(() => {
41
+ return componentProps.id
42
+ ? getComponent(componentProps.components, descriptionsData.value)
43
+ : getComponent(componentProps.components)
44
+ });
45
+
46
+ // 2. 动态构建 Model 绑定 (仅在有 id 时绑定)
47
+ const dynamicModel = vue.computed(() => {
48
+ return componentProps.id ? { modelValue: descriptionsData.value[componentProps.id] } : {}
49
+ });
50
+
40
51
  return (_ctx, _cache) => {
41
52
  return vue.renderSlot(_ctx.$slots, __props.components, {}, () => [
42
- (__props.id)
43
- ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(getComponent)(__props.components, descriptionsData.value)), vue.mergeProps({
44
- key: 0,
45
- modelValue: descriptionsData.value[__props.id],
46
- "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => ((descriptionsData.value[__props.id]) = $event))
47
- }, __props.props), null, 16 /* FULL_PROPS */, ["modelValue"]))
48
- : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(getComponent)(__props.components)), vue.normalizeProps(vue.mergeProps({ key: 1 }, __props.props)), null, 16 /* FULL_PROPS */))
53
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(currentComponent.value), vue.mergeProps({ ...dynamicModel.value, ...__props.props }, {
54
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = val => __props.id && (descriptionsData.value[__props.id] = val))
55
+ }), null, 16 /* FULL_PROPS */))
49
56
  ])
50
57
  }
51
58
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vue = require('vue');
6
6
  var elementPlus = require('element-plus');
7
- var shared_esmBundler = require('../../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.js');
7
+ var type = require('../../../utils/type.js');
8
8
  var comp = require('./comp.vue.js');
9
9
 
10
10
  const _hoisted_1 = { class: "epl-descriptions" };
@@ -35,18 +35,18 @@ const descriptionsData = vue.useModel(__props, "modelValue");
35
35
  // 内部处理单个列表的函数
36
36
  const normalizeItems = list => {
37
37
  return list.reduce((prev, item) => {
38
- const isHidden = shared_esmBundler.isFunction(item.hidden) ? item.hidden(descriptionsData.value) : item.hidden;
38
+ const isHidden = type.isFunction(item.hidden) ? item.hidden(descriptionsData.value) : item.hidden;
39
39
 
40
40
  if (isHidden) return prev
41
41
 
42
42
  prev.push({
43
43
  ...item,
44
- label: shared_esmBundler.isObject(item.label)
44
+ label: type.isObject(item.label)
45
45
  ? item.label
46
46
  : {
47
47
  components: item.label
48
48
  },
49
- value: shared_esmBundler.isObject(item.value)
49
+ value: type.isObject(item.value)
50
50
  ? item.value
51
51
  : {
52
52
  id: item.value,
@@ -69,7 +69,7 @@ const renderList = vue.computed(() => {
69
69
  // 分组模式
70
70
  return props.items
71
71
  .filter(group => {
72
- const isHidden = shared_esmBundler.isFunction(group.hidden) ? group.hidden(descriptionsData.value) : group.hidden;
72
+ const isHidden = type.isFunction(group.hidden) ? group.hidden(descriptionsData.value) : group.hidden;
73
73
  return !isHidden
74
74
  })
75
75
  .map(group => {
@@ -2,9 +2,8 @@
2
2
 
3
3
  var vue = require('vue');
4
4
  var elementPlus = require('element-plus');
5
- var shared_esmBundler = require('../../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.js');
6
- var appContext = require('../../../utils/vue/appContext.js');
7
5
  var type = require('../../../utils/type.js');
6
+ var appContext = require('../../../utils/vue/appContext.js');
8
7
 
9
8
  /**
10
9
  *
@@ -77,11 +76,11 @@ const useDialog = (component, componentProps = {}, modalProps = {}, context = nu
77
76
  try {
78
77
  const target = componentRef.value;
79
78
  // 调用组件方法
80
- if (target && methodKey && shared_esmBundler.isFunction(target[methodKey])) {
79
+ if (target && methodKey && type.isFunction(target[methodKey])) {
81
80
  await target[methodKey]();
82
81
  }
83
82
  // 调用 onConfirm
84
- if (shared_esmBundler.isFunction(onConfirm)) {
83
+ if (type.isFunction(onConfirm)) {
85
84
  await onConfirm(target);
86
85
  }
87
86
  // 返回 resolve
@@ -96,7 +95,7 @@ const useDialog = (component, componentProps = {}, modalProps = {}, context = nu
96
95
 
97
96
  // 取消
98
97
  const handleCancel = () => {
99
- if (shared_esmBundler.isFunction(onCancel)) onCancel();
98
+ if (type.isFunction(onCancel)) onCancel();
100
99
  handleAction("reject", "closed");
101
100
  };
102
101
 
@@ -138,7 +137,7 @@ const useDialog = (component, componentProps = {}, modalProps = {}, context = nu
138
137
  footer: () => {
139
138
  // 自定义 footer
140
139
  if (footer) {
141
- return shared_esmBundler.isFunction(footer)
140
+ return type.isFunction(footer)
142
141
  ? footer({ close: handleCancel, confirm: handleConfirm, loading: loading.value })
143
142
  : footer
144
143
  }
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var vue = require('vue');
6
6
  var iconsVue = require('@element-plus/icons-vue');
7
7
  var scrollTo = require('./scrollTo.js');
8
- var shared_esmBundler = require('../../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.js');
9
8
  var type = require('../../../utils/type.js');
10
9
  require('./table.vue2.js');
11
10
  var _pluginVue_exportHelper = require('../../../../_virtual/_plugin-vue_export-helper.js');
@@ -88,19 +87,19 @@ const headSpanFit = column => {
88
87
 
89
88
  // 判断列是否显示
90
89
  const isColumnVisible = column => {
91
- if (shared_esmBundler.isFunction(column.show)) return column.show()
90
+ if (type.isFunction(column.show)) return column.show()
92
91
  return column.show !== false
93
92
  };
94
93
 
95
94
  // 获取渲染内容
96
95
  const getRenderContent = (column, scope) => {
97
- return shared_esmBundler.isFunction(column.render) ? column.render(scope) : column.render
96
+ return type.isFunction(column.render) ? column.render(scope) : column.render
98
97
  };
99
98
 
100
99
  // 获取可见按钮
101
100
  const getVisibleButtons = row => {
102
101
  const list = (props.operates?.list || []).filter(item => {
103
- return shared_esmBundler.isFunction(item.show) ? item.show(row) : item.show !== false
102
+ return type.isFunction(item.show) ? item.show(row) : item.show !== false
104
103
  });
105
104
  return list.length > 3
106
105
  ? {
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var vue = require('vue');
4
- var shared_esmBundler = require('../../../node_modules/.pnpm/@vue_shared@3.5.27/node_modules/@vue/shared/dist/shared.esm-bundler.js');
5
4
  var type = require('../../utils/type.js');
6
5
 
7
6
  function useDynamicComponent() {
@@ -14,7 +13,7 @@ function useDynamicComponent() {
14
13
  const getComponent = (type$1, scope) => {
15
14
  // 非 string / number,说明是组件对象或渲染函数
16
15
  if (type$1 && !type.isString(type$1) && !type.isNumber(type$1)) {
17
- return shared_esmBundler.isFunction(type$1) ? type$1(scope) : type$1
16
+ return type.isFunction(type$1) ? type$1(scope) : type$1
18
17
  }
19
18
 
20
19
  const componentKey = type$1;
@@ -1,9 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  const isUndefined = val => typeof val === "undefined";
4
- const isNumber = val => typeof val === "number";
4
+ const isNumber = val => typeof val === "number" && !Number.isNaN(val);
5
+
6
+ // === vue shared ===
5
7
  const isString = val => typeof val === "string";
8
+ const isFunction = val => typeof val === "function";
9
+ const isObject = val => val !== null && typeof val === "object";
6
10
 
11
+ exports.isFunction = isFunction;
7
12
  exports.isNumber = isNumber;
13
+ exports.isObject = isObject;
8
14
  exports.isString = isString;
9
15
  exports.isUndefined = isUndefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-elplus",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "A Component Library for Vue 3",
5
5
  "author": {
6
6
  "name": "Mr.Jia",
@@ -19,6 +19,7 @@
19
19
  "url": "https://github.com/jiayc4215/easy-elplus/issues"
20
20
  },
21
21
  "license": "MIT",
22
+ "sideEffects": false,
22
23
  "main": "lib/index.js",
23
24
  "module": "es/index.mjs",
24
25
  "unpkg": "dist/index.full.js",
@@ -44,16 +45,15 @@
44
45
  "registry": "https://registry.npmjs.org/"
45
46
  },
46
47
  "dependencies": {
47
- "@vue/shared": "^3.5.27",
48
48
  "lodash-es": "^4.17.23"
49
49
  },
50
+ "peerDependencies": {
51
+ "element-plus": "^2.9.4"
52
+ },
50
53
  "engines": {
51
54
  "node": ">= 4.0.0",
52
55
  "npm": ">= 3.0.0"
53
56
  },
54
- "peerDependencies": {
55
- "vue": "^3.3.0"
56
- },
57
57
  "browserslist": [
58
58
  "> 1%",
59
59
  "not ie 11",
@@ -1,13 +0,0 @@
1
- /**
2
- * @vue/shared v3.5.27
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/
6
-
7
-
8
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
9
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
10
- const isFunction = (val) => typeof val === "function";
11
- const isObject = (val) => val !== null && typeof val === "object";
12
-
13
- export { isFunction, isObject };
@@ -1,25 +0,0 @@
1
- /**
2
- * 全局应用上下文管理
3
- * 用于在非组件上下文中访问主应用的配置、插件和全局组件
4
- */
5
-
6
- let globalAppContext = null;
7
-
8
- /**
9
- * 设置全局应用上下文
10
- * 应该在主应用初始化时调用(通常在 app.use() 中)
11
- * @param {AppContext} context - Vue 应用上下文
12
- */
13
- function setGlobalAppContext(context) {
14
- globalAppContext = context;
15
- }
16
-
17
- /**
18
- * 获取全局应用上下文
19
- * @returns {AppContext | null}
20
- */
21
- function getGlobalAppContext() {
22
- return globalAppContext
23
- }
24
-
25
- export { getGlobalAppContext, setGlobalAppContext };
@@ -1,130 +0,0 @@
1
- import { ref, createApp, h, getCurrentInstance } from 'vue';
2
- import { ElConfigProvider, ElDialog, ElButton } from 'element-plus';
3
- import { getApp } from '../../../utils/vue/install.mjs';
4
- import { isString } from '../../../utils/type.mjs';
5
-
6
- function useEplDialog(componet, props, DialogProps) {
7
- if (isString(componet)) {
8
- const text = componet;
9
- componet = () => h("div", text);
10
- }
11
-
12
- const modal = ref(true);
13
- const instance = ref();
14
- const disabled = ref(false);
15
- const cb = DialogProps.cb;
16
-
17
- const dialog = () =>
18
- h(
19
- ElConfigProvider,
20
- {
21
- locale: getCurrentInstance()?.appContext?.config.globalProperties?.locale
22
- },
23
- {
24
- default: () =>
25
- h(
26
- ElDialog,
27
- {
28
- ...DialogProps,
29
- modelValue: modal.value
30
- },
31
- {
32
- default: () => h(componet, { ref: instance, ...props }),
33
- footer: DialogProps.footer
34
- }
35
- )
36
- }
37
- );
38
-
39
- const app = createApp(dialog);
40
-
41
- // 同步全局 app 的上下文
42
- const globalApp = getApp();
43
- if (globalApp) {
44
- app._context.components = { ...globalApp._context.components, ...app._context.components };
45
- app._context.directives = { ...globalApp._context.directives, ...app._context.directives };
46
- app._context.provides = { ...globalApp._context.provides, ...app._context.provides };
47
- }
48
-
49
- const div = document.createElement("div");
50
- document.body.appendChild(div);
51
- app.mount(div);
52
-
53
- const close = () => {
54
- modal.value = false;
55
- };
56
-
57
- const createConfirm = props => {
58
- const Component = {
59
- setup() {
60
- const _props = {
61
- name: "确认",
62
- hidden: false,
63
- autoClose: true,
64
- click: "confirm",
65
- ...(isString(props) ? { name: props } : props)
66
- };
67
-
68
- const { name, hidden, autoClose, click } = _props;
69
- const loading = ref(false);
70
-
71
- const onClick = async () => {
72
- try {
73
- loading.value = true;
74
- disabled.value = true;
75
-
76
- if (isString(click)) {
77
- await instance.value?.[click]?.();
78
- } else {
79
- await click?.(instance);
80
- }
81
-
82
- cb?.();
83
- autoClose && close();
84
- } finally {
85
- loading.value = false;
86
- const t = setTimeout(() => {
87
- disabled.value = false;
88
- clearTimeout(t);
89
- }, 200);
90
- }
91
- };
92
-
93
- return () =>
94
- !hidden &&
95
- h(
96
- ElButton,
97
- {
98
- loading: loading.value,
99
- type: "primary",
100
- disabled: disabled.value,
101
- onClick,
102
- ..._props
103
- },
104
- () => name
105
- )
106
- }
107
- };
108
-
109
- return h(Component)
110
- };
111
-
112
- const createCancel = (name = "取消", props) => {
113
- const Component = {
114
- setup() {
115
- return () => h(ElButton, { ...props, onClick: close }, () => name)
116
- }
117
- };
118
-
119
- return h(Component)
120
- };
121
-
122
- return {
123
- instance,
124
- close,
125
- createConfirm,
126
- createCancel
127
- }
128
- }
129
-
130
- export { useEplDialog };
@@ -1,72 +0,0 @@
1
- import { computed, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, mergeProps, createSlots, withCtx, renderSlot, resolveDynamicComponent } from 'vue';
2
- import { ElTableColumn } from 'element-plus';
3
- import { useDynamicComponent } from '../../../hooks/src/useDynamicComponent.mjs';
4
- import omit from '../../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/omit.mjs';
5
-
6
- const _sfc_main = /*@__PURE__*/Object.assign({
7
- name: "EasyTableColumn"
8
- }, {
9
- __name: 'tableColumn',
10
- props: {
11
- columns: {
12
- type: Array,
13
- default: () => []
14
- }
15
- },
16
- setup(__props) {
17
-
18
-
19
-
20
- const props = __props;
21
-
22
- const columns = computed(() => {
23
- return props.columns.filter(column => !column.hidden)
24
- });
25
-
26
- const { getComponent } = useDynamicComponent();
27
-
28
- /**
29
- * 获取列属性(过滤掉自定义属性)
30
- */
31
- const getColumnProps = column => {
32
- return omit(column, ["compType", "compProps", "header", "hidden"])
33
- };
34
-
35
- return (_ctx, _cache) => {
36
- return (openBlock(true), createElementBlock(Fragment, null, renderList(columns.value, (column) => {
37
- return (openBlock(), createBlock(unref(ElTableColumn), mergeProps({
38
- key: column.prop || column.label
39
- }, { ref_for: true }, getColumnProps(column)), createSlots({ _: 2 /* DYNAMIC */ }, [
40
- (column.header)
41
- ? {
42
- name: "header",
43
- fn: withCtx((scope) => [
44
- renderSlot(_ctx.$slots, column.header, mergeProps({ ref_for: true }, scope), () => [
45
- (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(column.header, scope))))
46
- ])
47
- ]),
48
- key: "0"
49
- }
50
- : undefined,
51
- (column.compType || _ctx.$slots[column.prop])
52
- ? {
53
- name: "default",
54
- fn: withCtx((scope) => [
55
- renderSlot(_ctx.$slots, column.prop, mergeProps({ ref_for: true }, scope), () => [
56
- (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(column.compType, scope)), mergeProps({
57
- modelValue: scope.row[column.prop],
58
- "onUpdate:modelValue": $event => ((scope.row[column.prop]) = $event)
59
- }, { ref_for: true }, column.compProps || {}), null, 16 /* FULL_PROPS */, ["modelValue", "onUpdate:modelValue"]))
60
- ])
61
- ]),
62
- key: "1"
63
- }
64
- : undefined
65
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */))
66
- }), 128 /* KEYED_FRAGMENT */))
67
- }
68
- }
69
-
70
- });
71
-
72
- export { _sfc_main as default };
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * @vue/shared v3.5.27
5
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
6
- * @license MIT
7
- **/
8
-
9
-
10
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
11
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
12
- const isFunction = (val) => typeof val === "function";
13
- const isObject = (val) => val !== null && typeof val === "object";
14
-
15
- exports.isFunction = isFunction;
16
- exports.isObject = isObject;
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * 全局应用上下文管理
5
- * 用于在非组件上下文中访问主应用的配置、插件和全局组件
6
- */
7
-
8
- let globalAppContext = null;
9
-
10
- /**
11
- * 设置全局应用上下文
12
- * 应该在主应用初始化时调用(通常在 app.use() 中)
13
- * @param {AppContext} context - Vue 应用上下文
14
- */
15
- function setGlobalAppContext(context) {
16
- globalAppContext = context;
17
- }
18
-
19
- /**
20
- * 获取全局应用上下文
21
- * @returns {AppContext | null}
22
- */
23
- function getGlobalAppContext() {
24
- return globalAppContext
25
- }
26
-
27
- exports.getGlobalAppContext = getGlobalAppContext;
28
- exports.setGlobalAppContext = setGlobalAppContext;
@@ -1,132 +0,0 @@
1
- 'use strict';
2
-
3
- var vue = require('vue');
4
- var elementPlus = require('element-plus');
5
- var install = require('../../../utils/vue/install.js');
6
- var type = require('../../../utils/type.js');
7
-
8
- function useEplDialog(componet, props, DialogProps) {
9
- if (type.isString(componet)) {
10
- const text = componet;
11
- componet = () => vue.h("div", text);
12
- }
13
-
14
- const modal = vue.ref(true);
15
- const instance = vue.ref();
16
- const disabled = vue.ref(false);
17
- const cb = DialogProps.cb;
18
-
19
- const dialog = () =>
20
- vue.h(
21
- elementPlus.ElConfigProvider,
22
- {
23
- locale: vue.getCurrentInstance()?.appContext?.config.globalProperties?.locale
24
- },
25
- {
26
- default: () =>
27
- vue.h(
28
- elementPlus.ElDialog,
29
- {
30
- ...DialogProps,
31
- modelValue: modal.value
32
- },
33
- {
34
- default: () => vue.h(componet, { ref: instance, ...props }),
35
- footer: DialogProps.footer
36
- }
37
- )
38
- }
39
- );
40
-
41
- const app = vue.createApp(dialog);
42
-
43
- // 同步全局 app 的上下文
44
- const globalApp = install.getApp();
45
- if (globalApp) {
46
- app._context.components = { ...globalApp._context.components, ...app._context.components };
47
- app._context.directives = { ...globalApp._context.directives, ...app._context.directives };
48
- app._context.provides = { ...globalApp._context.provides, ...app._context.provides };
49
- }
50
-
51
- const div = document.createElement("div");
52
- document.body.appendChild(div);
53
- app.mount(div);
54
-
55
- const close = () => {
56
- modal.value = false;
57
- };
58
-
59
- const createConfirm = props => {
60
- const Component = {
61
- setup() {
62
- const _props = {
63
- name: "确认",
64
- hidden: false,
65
- autoClose: true,
66
- click: "confirm",
67
- ...(type.isString(props) ? { name: props } : props)
68
- };
69
-
70
- const { name, hidden, autoClose, click } = _props;
71
- const loading = vue.ref(false);
72
-
73
- const onClick = async () => {
74
- try {
75
- loading.value = true;
76
- disabled.value = true;
77
-
78
- if (type.isString(click)) {
79
- await instance.value?.[click]?.();
80
- } else {
81
- await click?.(instance);
82
- }
83
-
84
- cb?.();
85
- autoClose && close();
86
- } finally {
87
- loading.value = false;
88
- const t = setTimeout(() => {
89
- disabled.value = false;
90
- clearTimeout(t);
91
- }, 200);
92
- }
93
- };
94
-
95
- return () =>
96
- !hidden &&
97
- vue.h(
98
- elementPlus.ElButton,
99
- {
100
- loading: loading.value,
101
- type: "primary",
102
- disabled: disabled.value,
103
- onClick,
104
- ..._props
105
- },
106
- () => name
107
- )
108
- }
109
- };
110
-
111
- return vue.h(Component)
112
- };
113
-
114
- const createCancel = (name = "取消", props) => {
115
- const Component = {
116
- setup() {
117
- return () => vue.h(elementPlus.ElButton, { ...props, onClick: close }, () => name)
118
- }
119
- };
120
-
121
- return vue.h(Component)
122
- };
123
-
124
- return {
125
- instance,
126
- close,
127
- createConfirm,
128
- createCancel
129
- }
130
- }
131
-
132
- exports.useEplDialog = useEplDialog;
@@ -1,76 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var vue = require('vue');
6
- var elementPlus = require('element-plus');
7
- var useDynamicComponent = require('../../../hooks/src/useDynamicComponent.js');
8
- var omit = require('../../../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/omit.js');
9
-
10
- const _sfc_main = /*@__PURE__*/Object.assign({
11
- name: "EasyTableColumn"
12
- }, {
13
- __name: 'tableColumn',
14
- props: {
15
- columns: {
16
- type: Array,
17
- default: () => []
18
- }
19
- },
20
- setup(__props) {
21
-
22
-
23
-
24
- const props = __props;
25
-
26
- const columns = vue.computed(() => {
27
- return props.columns.filter(column => !column.hidden)
28
- });
29
-
30
- const { getComponent } = useDynamicComponent.useDynamicComponent();
31
-
32
- /**
33
- * 获取列属性(过滤掉自定义属性)
34
- */
35
- const getColumnProps = column => {
36
- return omit.default(column, ["compType", "compProps", "header", "hidden"])
37
- };
38
-
39
- return (_ctx, _cache) => {
40
- return (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(columns.value, (column) => {
41
- return (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTableColumn), vue.mergeProps({
42
- key: column.prop || column.label
43
- }, { ref_for: true }, getColumnProps(column)), vue.createSlots({ _: 2 /* DYNAMIC */ }, [
44
- (column.header)
45
- ? {
46
- name: "header",
47
- fn: vue.withCtx((scope) => [
48
- vue.renderSlot(_ctx.$slots, column.header, vue.mergeProps({ ref_for: true }, scope), () => [
49
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(getComponent)(column.header, scope))))
50
- ])
51
- ]),
52
- key: "0"
53
- }
54
- : undefined,
55
- (column.compType || _ctx.$slots[column.prop])
56
- ? {
57
- name: "default",
58
- fn: vue.withCtx((scope) => [
59
- vue.renderSlot(_ctx.$slots, column.prop, vue.mergeProps({ ref_for: true }, scope), () => [
60
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(getComponent)(column.compType, scope)), vue.mergeProps({
61
- modelValue: scope.row[column.prop],
62
- "onUpdate:modelValue": $event => ((scope.row[column.prop]) = $event)
63
- }, { ref_for: true }, column.compProps || {}), null, 16 /* FULL_PROPS */, ["modelValue", "onUpdate:modelValue"]))
64
- ])
65
- ]),
66
- key: "1"
67
- }
68
- : undefined
69
- ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */))
70
- }), 128 /* KEYED_FRAGMENT */))
71
- }
72
- }
73
-
74
- });
75
-
76
- exports.default = _sfc_main;
package/public/qq.jpg DELETED
Binary file