@elementplus-kit/uikit 1.5.0 → 1.7.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.
- package/components/form/src/FormItem.ts +3 -2
- package/components/form/src/index.ts +9 -18
- package/components/search/src/index.tsx +17 -9
- package/package.json +11 -4
- package/vite.config.ts +14 -10
- package/aaaindex.ts +0 -55
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, h, toRefs, inject, type PropType } from "vue";
|
|
2
2
|
import {
|
|
3
3
|
ElFormItem,
|
|
4
4
|
ElInput,
|
|
@@ -110,7 +110,8 @@ export default defineComponent({
|
|
|
110
110
|
if (isFunction(attrs.value?.disabled)) {
|
|
111
111
|
disabled = attrs.value.disabled(props.mergeParams);
|
|
112
112
|
}
|
|
113
|
-
if (isBoolean(attrs.value?.disabled)) {
|
|
113
|
+
if (isBoolean(attrs.value?.disabled)) {
|
|
114
|
+
// 在 attrs 后面结构, 也要处理直接赋值的情况,不然会覆盖
|
|
114
115
|
disabled = attrs.value.disabled;
|
|
115
116
|
}
|
|
116
117
|
// 全部只读
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
type ExtractPropTypes,
|
|
10
10
|
type PropType,
|
|
11
11
|
} from "vue";
|
|
12
|
-
import {
|
|
13
|
-
import zhCn from "element-plus/es/locale/lang/zh-cn";
|
|
12
|
+
import { ElForm, ElRow, ElCol } from "element-plus";
|
|
13
|
+
// import zhCn from "element-plus/es/locale/lang/zh-cn";
|
|
14
14
|
import CFormItem from "./FormItem.ts";
|
|
15
|
-
import { has,
|
|
15
|
+
import { has, isFunction } from "lodash-es";
|
|
16
16
|
import { getEmits } from "./constants"; // 获取所有的事件
|
|
17
17
|
import "../style/index.scss";
|
|
18
18
|
const propsAttrs = {
|
|
@@ -179,24 +179,15 @@ export default defineComponent({
|
|
|
179
179
|
// 渲染表单
|
|
180
180
|
const renderForm = () => {
|
|
181
181
|
return h(
|
|
182
|
-
|
|
182
|
+
ElForm,
|
|
183
183
|
{
|
|
184
|
-
|
|
184
|
+
ref: cFormFnRef,
|
|
185
|
+
...$attrs,
|
|
186
|
+
model: model.value,
|
|
187
|
+
class: allReadonly.value ? "isReadonly c-form" : "c-form", // 放在 $attrs 后面可自动合并 放在 $attrs 前面会被 $attrs.class 覆盖, h函数渲染的是标签就会覆盖 是组件就会合并不用管顺序
|
|
185
188
|
},
|
|
186
189
|
{
|
|
187
|
-
default: () =>
|
|
188
|
-
h(
|
|
189
|
-
ElForm,
|
|
190
|
-
{
|
|
191
|
-
ref: cFormFnRef,
|
|
192
|
-
...$attrs,
|
|
193
|
-
model: model.value,
|
|
194
|
-
class: allReadonly.value ? "isReadonly c-form" : "c-form", // 放在 $attrs 后面可自动合并 放在 $attrs 前面会被 $attrs.class 覆盖, h函数渲染的是标签就会覆盖 是组件就会合并不用管顺序
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
default: () => renderRow(),
|
|
198
|
-
}
|
|
199
|
-
),
|
|
190
|
+
default: () => renderRow(),
|
|
200
191
|
}
|
|
201
192
|
);
|
|
202
193
|
};
|
|
@@ -23,7 +23,7 @@ export default defineComponent({
|
|
|
23
23
|
|
|
24
24
|
setup(props, { emit, slots, attrs, expose }) {
|
|
25
25
|
// 自己的 slot
|
|
26
|
-
const slotsList = ["
|
|
26
|
+
const slotsList = ["btn-left", "btn-right"];
|
|
27
27
|
// 解析 attrs 中的事件
|
|
28
28
|
const getEvent = () => {
|
|
29
29
|
let formObj: any = {};
|
|
@@ -204,7 +204,7 @@ export default defineComponent({
|
|
|
204
204
|
</div>
|
|
205
205
|
</div>
|
|
206
206
|
<div className="c-search-simple-btn" ref={simpleBtnRef}>
|
|
207
|
-
{slots["
|
|
207
|
+
{slots["arrow-left"]?.()}
|
|
208
208
|
{showCount.value < props.formOptions?.length && (
|
|
209
209
|
<div
|
|
210
210
|
className={`c-search-simple-icon ${showSearchForm.value ? "icon-rotate" : ""
|
|
@@ -216,13 +216,21 @@ export default defineComponent({
|
|
|
216
216
|
</el-icon>
|
|
217
217
|
</div>
|
|
218
218
|
)}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
219
|
+
{slots["search-btn"]
|
|
220
|
+
? slots["search-btn"]()
|
|
221
|
+
: (
|
|
222
|
+
<>
|
|
223
|
+
{slots["btn-left"]?.()}
|
|
224
|
+
<el-button type="primary" onClick={handleSearch}>
|
|
225
|
+
搜索
|
|
226
|
+
</el-button>
|
|
227
|
+
<el-button type="primary" onClick={handleReset}>
|
|
228
|
+
重置
|
|
229
|
+
</el-button>
|
|
230
|
+
{slots["btn-right"]?.()}
|
|
231
|
+
</>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
226
234
|
</div>
|
|
227
235
|
</div>
|
|
228
236
|
|
package/package.json
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementplus-kit/uikit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./components/index.ts",
|
|
6
6
|
"peerDependencies": {
|
|
7
|
-
"element-plus": "
|
|
8
|
-
"
|
|
7
|
+
"@element-plus/icons-vue": "*",
|
|
8
|
+
"element-plus": "*",
|
|
9
|
+
"lodash-es": "*",
|
|
10
|
+
"vue": "*"
|
|
9
11
|
},
|
|
10
12
|
"keywords": [],
|
|
11
13
|
"author": "",
|
|
12
14
|
"license": "ISC",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
17
|
+
"@vitejs/plugin-vue-jsx": "^5.0.1",
|
|
18
|
+
"vite": "^7.1.3"
|
|
19
|
+
},
|
|
13
20
|
"scripts": {
|
|
14
|
-
"build": "build",
|
|
21
|
+
"build": "vite build",
|
|
15
22
|
"pub": "npx standard-version && npm publish"
|
|
16
23
|
}
|
|
17
24
|
}
|
package/vite.config.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
2
|
-
import vue from
|
|
3
|
-
import vueJsx from
|
|
4
|
-
import dts from 'vite-plugin-dts'
|
|
5
|
-
import { resolve } from 'path'
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import vue from "@vitejs/plugin-vue";
|
|
3
|
+
import vueJsx from "@vitejs/plugin-vue-jsx";
|
|
4
|
+
// import dts from 'vite-plugin-dts'
|
|
5
|
+
// import { resolve } from 'path'
|
|
6
6
|
|
|
7
7
|
export default defineConfig({
|
|
8
8
|
plugins: [
|
|
@@ -14,13 +14,17 @@ export default defineConfig({
|
|
|
14
14
|
// }),
|
|
15
15
|
],
|
|
16
16
|
build: {
|
|
17
|
+
// 指定打包输出目录名称,替换成你想要的名字
|
|
18
|
+
outDir: "dist",
|
|
17
19
|
lib: {
|
|
18
|
-
entry:
|
|
19
|
-
name:
|
|
20
|
-
fileName:
|
|
20
|
+
entry: "components/index.ts",
|
|
21
|
+
name: "ElementPlusKit",
|
|
22
|
+
fileName: "index",
|
|
23
|
+
// fileName: (format) => `my-utils.${format}.js`,
|
|
21
24
|
},
|
|
22
25
|
rollupOptions: {
|
|
23
|
-
external: [
|
|
26
|
+
external: ["vue", "element-plus", "lodash-es", "@element-plus/icons-vue"],
|
|
24
27
|
},
|
|
28
|
+
emptyOutDir: true,
|
|
25
29
|
},
|
|
26
|
-
})
|
|
30
|
+
});
|
package/aaaindex.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// // 引入封装好的组件
|
|
2
|
-
// // import kButton from "./k-button/index.vue";
|
|
3
|
-
// // 将来如果有其它组件,都可以写到这个数组里
|
|
4
|
-
// // const coms = [kButton];
|
|
5
|
-
|
|
6
|
-
// // 批量组件注册
|
|
7
|
-
// const install = function (Vue, options) {
|
|
8
|
-
// console.log("🚀 ~ install ~ Vue:", Vue);
|
|
9
|
-
// console.log("插件安装了 ", options);
|
|
10
|
-
|
|
11
|
-
// coms.forEach((com) => {
|
|
12
|
-
// console.log("🚀 ~ install ~ com:", com);
|
|
13
|
-
// Vue.component("k-button", com);
|
|
14
|
-
// });
|
|
15
|
-
// };
|
|
16
|
-
|
|
17
|
-
// import { capitalize } from "lodash-es";
|
|
18
|
-
|
|
19
|
-
// // import { prefix as basePrefix } from "./config.ts";
|
|
20
|
-
// // 将来如果有其它组件,都可以写到这个数组里
|
|
21
|
-
// // const coms = [CForm, CTable, CTable2, CPagination, CDialog, CDrawer, CSearch];
|
|
22
|
-
|
|
23
|
-
// // 批量组件注册
|
|
24
|
-
// const install = function (app, options = {}) {
|
|
25
|
-
// // 获取自定义前缀,默认使用组件原名称
|
|
26
|
-
// // let { prefix = "" } = options;
|
|
27
|
-
// // prefix = capitalize(prefix) || basePrefix;
|
|
28
|
-
// // // 循环注册
|
|
29
|
-
// // coms.forEach((item) => {
|
|
30
|
-
// // // 组件可能直接是组件对象,或者有com属性
|
|
31
|
-
// // const component = item.com || item;
|
|
32
|
-
// // const componentName = component.name || item.name;
|
|
33
|
-
// // if (componentName) {
|
|
34
|
-
// // // 生成注册名称:前缀 + 组件名
|
|
35
|
-
// // const registerName = prefix
|
|
36
|
-
// // ? `${prefix}${componentName.replace(/^[A-Z]/, (char) =>
|
|
37
|
-
// // char.toLowerCase()
|
|
38
|
-
// // )}`
|
|
39
|
-
// // : componentName;
|
|
40
|
-
// // // 注册组件
|
|
41
|
-
// // app.component(registerName, component);
|
|
42
|
-
// // }
|
|
43
|
-
// // });
|
|
44
|
-
// };
|
|
45
|
-
|
|
46
|
-
// // 创建插件对象,包含install方法
|
|
47
|
-
// const plugin = {
|
|
48
|
-
// install,
|
|
49
|
-
// };
|
|
50
|
-
|
|
51
|
-
// // 导出插件
|
|
52
|
-
// // export default plugin; // 这个方法以后再使用的时候可以被use调用
|
|
53
|
-
// // 为什么导出为install? 安装 Vue.js 插件。如果插件是一个对象,必须提供 install 方法。
|
|
54
|
-
// // 如果插件是一个函数,它会被作为install 方法。install 方法调用时,会将 Vue 作为参数传入。
|
|
55
|
-
// export default install; // 这个方法以后再使用的时候可以被use调用
|