leisure-core 0.5.36 → 0.5.38

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.
@@ -9,6 +9,7 @@
9
9
  <le-button type="primary" @click="addItem()" v-if="isDispAddBtn">{{
10
10
  addBtnText
11
11
  }}</le-button>
12
+ <slot name="btnright"></slot>
12
13
  <slot name="headerBtns" :params="searchData"></slot>
13
14
  </div>
14
15
  </el-form-item>
@@ -103,6 +103,10 @@ export default {
103
103
  type: String,
104
104
  default: "16px",
105
105
  },
106
+ externalComponentMap: {
107
+ type: Object,
108
+ default: () => ({}),
109
+ },
106
110
  },
107
111
  watch: {
108
112
  formData: {
@@ -125,7 +129,13 @@ export default {
125
129
  },
126
130
  data() {
127
131
  return {
128
- componentMap: {
132
+ formPop: {},
133
+ options: {}, //{field1:[{value:1,label:'选项1'},{value:2,label:'选项2'}]}
134
+ };
135
+ },
136
+ computed: {
137
+ dynamicComponentMap() {
138
+ const baseMap = {
129
139
  input: {
130
140
  component: "le-input",
131
141
  props: { placeholder: "请输入" },
@@ -154,12 +164,9 @@ export default {
154
164
  component: "le-area",
155
165
  props: {},
156
166
  },
157
- },
158
- formPop: {},
159
- options: {}, //{field1:[{value:1,label:'选项1'},{value:2,label:'选项2'}]}
160
- };
161
- },
162
- computed: {
167
+ };
168
+ return { ...baseMap, ...this.externalComponentMap };
169
+ },
163
170
  gridStyle() {
164
171
  return {
165
172
  "grid-template-columns": `repeat(${this.columnsPerRow}, 1fr)`,
@@ -171,19 +178,27 @@ export default {
171
178
  mounted() {},
172
179
  methods: {
173
180
  componentType(type) {
174
- let result = this.componentMap[type]?.component || "le-input";
175
- return result;
181
+ if (!this.dynamicComponentMap[type]) {
182
+ return "le-input";
183
+ }
184
+ return this.dynamicComponentMap[type]?.component || "le-input";
176
185
  },
177
186
  getComponentProps(item) {
178
187
  let type = item.type;
179
- let props = this.componentMap[type]?.props || {};
188
+
189
+ // 如果组件类型未定义,返回空对象
190
+ if (!this.dynamicComponentMap[type]) {
191
+ return {};
192
+ }
193
+
194
+ let props = this.dynamicComponentMap[type]?.props || {};
180
195
  if (type === "image") {
181
196
  let images = [];
182
197
  images.push(this.formPop[item.prop]);
183
198
  props = { ...props, images: images };
184
199
  return props;
185
200
  }
186
- return this.componentMap[item.type]?.props || {};
201
+ return this.dynamicComponentMap[item.type]?.props || {};
187
202
  },
188
203
  mergeProps(defaultProps, customProps) {
189
204
  return { ...defaultProps, ...customProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leisure-core",
3
- "version": "0.5.36",
3
+ "version": "0.5.38",
4
4
  "description": "leisure-core是京心数据基于vue2.x开发的一套后台管理系统桌面端组件库,封装了大量实用的UI控件模板,非常方便开发者快速搭建前端应用",
5
5
  "private": false,
6
6
  "author": "北方乐逍遥(zcx7878)",