@form-create/element-ui 3.2.12 → 3.2.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@form-create/element-ui",
3
- "version": "3.2.12",
3
+ "version": "3.2.14",
4
4
  "description": "Element Plus版本低代码表单|FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的低代码表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。",
5
5
  "main": "./dist/form-create.min.js",
6
6
  "module": "./dist/form-create.esm.js",
@@ -46,16 +46,16 @@
46
46
  },
47
47
  "homepage": "http://www.form-create.com/v3/",
48
48
  "dependencies": {
49
- "@form-create/component-elm-checkbox": "^3.2.8",
50
- "@form-create/component-elm-frame": "^3.2.0",
51
- "@form-create/component-elm-group": "^3.2.8",
52
- "@form-create/component-elm-radio": "^3.2.8",
53
- "@form-create/component-elm-select": "^3.2.0",
54
- "@form-create/component-elm-tree": "^3.2.9",
55
- "@form-create/component-elm-upload": "^3.2.9",
49
+ "@form-create/component-elm-checkbox": "^3.2.14",
50
+ "@form-create/component-elm-frame": "^3.2.14",
51
+ "@form-create/component-elm-group": "^3.2.14",
52
+ "@form-create/component-elm-radio": "^3.2.14",
53
+ "@form-create/component-elm-select": "^3.2.14",
54
+ "@form-create/component-elm-tree": "^3.2.14",
55
+ "@form-create/component-elm-upload": "^3.2.14",
56
56
  "@form-create/component-subform": "^3.1.34",
57
- "@form-create/core": "^3.2.12",
58
- "@form-create/utils": "^3.2.0"
57
+ "@form-create/core": "^3.2.14",
58
+ "@form-create/utils": "^3.2.14"
59
59
  },
60
60
  "publishConfig": {
61
61
  "access": "public"
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@element-plus/icons-vue": "^0.2.7",
68
- "@form-create/component-wangeditor": "^3.2.4",
68
+ "@form-create/component-wangeditor": "^3.2.14",
69
69
  "@vue/cli-plugin-babel": "~4.5.0",
70
70
  "@vue/cli-service": "^4.5.3",
71
71
  "element-plus": "^2.8.3",
@@ -88,5 +88,5 @@
88
88
  "esm"
89
89
  ]
90
90
  },
91
- "gitHead": "81afc9dbc97908c11c30b6f1f7cbcebeb7c64731"
91
+ "gitHead": "e31cc649bf8c1199d8f8219e4cc3732d3dd458e3"
92
92
  }
package/src/core/alias.js CHANGED
@@ -28,6 +28,7 @@ export default {
28
28
  autoComplete: PRE + '-autocomplete',
29
29
  auto: PRE + '-autocomplete',
30
30
  group: 'fc-group',
31
+ array: 'fc-group',
31
32
  object: 'fc-sub-form',
32
33
  subForm: 'fc-sub-form',
33
34
  }
@@ -70,12 +70,7 @@ export default {
70
70
  return prop;
71
71
  },
72
72
  mergeProp(ctx) {
73
- ctx.prop = mergeProps([{
74
- info: this.options.info || {},
75
- wrap: this.options.wrap || {},
76
- col: this.options.col || {},
77
- title: this.options.title || {},
78
- }, ctx.prop], {
73
+ const def = {
79
74
  info: {
80
75
  trigger: 'hover',
81
76
  placement: 'top-start',
@@ -84,7 +79,10 @@ export default {
84
79
  title: {},
85
80
  col: {span: 24},
86
81
  wrap: {},
87
- }, {normal: ['title', 'info', 'col', 'wrap']});
82
+ };
83
+ ['info', 'wrap', 'col', 'title'].forEach(name => {
84
+ ctx.prop[name] = mergeProps([this.options[name] || {}, ctx.prop[name] || {}], def[name]);
85
+ });
88
86
  },
89
87
  getDefaultOptions() {
90
88
  return getConfig();
@@ -107,7 +105,7 @@ export default {
107
105
  const {key, ref, $handle} = this;
108
106
  extend(this.rule, {key, ref});
109
107
  extend(this.rule.props, {
110
- model: {...$handle.formData},
108
+ model: $handle.formData,
111
109
  });
112
110
  },
113
111
  render(children) {
@@ -132,7 +130,7 @@ export default {
132
130
  prop: ctx.id,
133
131
  rules: ctx.injectValidate(),
134
132
  },
135
- class: rule.className,
133
+ class: this.$render.mergeClass(rule.className, 'fc-form-item'),
136
134
  key: `${uni}fi`,
137
135
  ref: ctx.wrapRef,
138
136
  type: 'formItem',
@@ -150,7 +148,11 @@ export default {
150
148
  const isTip = isTooltip(infoProp);
151
149
  const form = this.options.form;
152
150
  const titleSlot = this.getSlot('title');
153
- const children = [titleSlot ? titleSlot({title: titleProp.title || '', rule: ctx.rule, options: this.options}) : ((titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || ''))];
151
+ const children = [titleSlot ? titleSlot({
152
+ title: ctx.refRule.__$title.value,
153
+ rule: ctx.rule,
154
+ options: this.options
155
+ }) : ((ctx.refRule.__$title.value) + (form.labelSuffix || form['label-suffix'] || ''))];
154
156
 
155
157
  if (!isFalse(infoProp.show) && (infoProp.info || infoProp.native) && !isFalse(infoProp.icon)) {
156
158
  const prop = {
@@ -167,7 +169,7 @@ export default {
167
169
 
168
170
  const field = 'content';
169
171
  if (infoProp.info && !hasProperty(prop.props, field)) {
170
- prop.props[field] = infoProp.info;
172
+ prop.props[field] = ctx.refRule.__$info.value;
171
173
  }
172
174
 
173
175
  children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), {
@@ -185,6 +187,7 @@ export default {
185
187
  const _prop = mergeProps([titleProp, {
186
188
  props: tidyRule(titleProp),
187
189
  key: `${uni}tit`,
190
+ class: 'fc-form-title',
188
191
  type: titleProp.type || 'span',
189
192
  }]);
190
193
 
@@ -197,7 +200,7 @@ export default {
197
200
  makeCol(rule, uni, children) {
198
201
  const col = rule.col;
199
202
  return this.$r({
200
- class: col.class,
203
+ class: this.$render.mergeClass(col.class, 'fc-form-col'),
201
204
  type: 'col',
202
205
  props: col || {span: 24},
203
206
  key: `${uni}col`
@@ -208,7 +211,7 @@ export default {
208
211
  return this.$r({
209
212
  type: 'row',
210
213
  props: row,
211
- class: row.class,
214
+ class: this.$render.mergeClass(row.class, 'fc-form-row'),
212
215
  key: `${this.key}row`
213
216
  }, children)
214
217
  },
@@ -225,6 +228,7 @@ export default {
225
228
  }
226
229
  const item = this.$r({
227
230
  type: 'formItem',
231
+ class: 'fc-form-item',
228
232
  key: `${this.key}fb`
229
233
  }, vn);
230
234
 
@@ -232,6 +236,7 @@ export default {
232
236
  ? item
233
237
  : this.$r({
234
238
  type: 'col',
239
+ class: 'fc-form-col fc-form-footer',
235
240
  props: {span: 24},
236
241
  key: `${this.key}fc`
237
242
  }, [item]);
@@ -247,7 +252,7 @@ export default {
247
252
  return this.$r({
248
253
  type: 'button',
249
254
  props: resetBtn,
250
- class: '_fc-reset-btn',
255
+ class: 'fc-reset-btn',
251
256
  style: {width: resetBtn.width},
252
257
  on: {
253
258
  click: () => {
@@ -270,14 +275,15 @@ export default {
270
275
  return this.$r({
271
276
  type: 'button',
272
277
  props: submitBtn,
273
- class: '_fc-submit-btn',
278
+ class: 'fc-submit-btn',
274
279
  style: {width: submitBtn.width},
275
280
  on: {
276
281
  click: () => {
277
282
  const fApi = this.$handle.api;
278
283
  this.options.submitBtn.click
279
284
  ? this.options.submitBtn.click(fApi)
280
- : fApi.submit().catch(()=>{});
285
+ : fApi.submit().catch(() => {
286
+ });
281
287
  }
282
288
  },
283
289
  key: `${this.key}b1`,
@@ -16,8 +16,12 @@ const required = {
16
16
  ...val,
17
17
  };
18
18
  if (!validate.message) {
19
- let title = rule.title || '';
20
- validate.message = ((typeof title === 'object' ? title.title : title) || '') + '不能为空';
19
+ validate.message = rule.__fc__.refRule.__$title.value + (api.getLocale() === 'en' ? ' is required' : '不能为空');
20
+ } else {
21
+ const match = validate.message.match(/^\{\{\s*\$t\.(.+)\s*\}\}$/);
22
+ if (match) {
23
+ validate.message = api.t(match[1], {title: rule.__fc__.refRule.__$title.value});
24
+ }
21
25
  }
22
26
  inject.getProp().validate = [validate];
23
27
  }
@@ -3,6 +3,7 @@ import {creatorFactory} from '@form-create/core/src/index';
3
3
  const DEFAULT_FORMATS = {
4
4
  date: 'YYYY-MM-DD',
5
5
  month: 'YYYY-MM',
6
+ week: 'YYYY-wo',
6
7
  datetime: 'YYYY-MM-DD HH:mm:ss',
7
8
  timerange: 'HH:mm:ss',
8
9
  daterange: 'YYYY-MM-DD',
@@ -10,12 +10,12 @@
10
10
  display: none !important;
11
11
  }
12
12
 
13
- .fc-wrap-left .el-form-item__label {
14
- justify-content: flex-start;
13
+ .fc-wrap-right .el-form-item__label {
14
+ justify-content: flex-end;
15
15
  }
16
16
 
17
17
  .fc-wrap-left .el-form-item__label {
18
- justify-content: flex-end;
18
+ justify-content: flex-start;
19
19
  }
20
20
 
21
21
  .fc-wrap-top.el-form-item {
@@ -44,3 +44,7 @@
44
44
  line-height: 20px;
45
45
  margin-bottom: 4px;
46
46
  }
47
+
48
+ .fc-form-footer {
49
+ margin-top: 12px;
50
+ }
package/types/config.d.ts CHANGED
@@ -31,21 +31,21 @@ type RowProps = {
31
31
  }
32
32
 
33
33
  export interface OptionAttrs {
34
- col?: Boolean | ColProps & {
34
+ col?: Boolean | Partial<ColProps & {
35
35
  labelWidth?: number | string;
36
36
  show?: Boolean;
37
- };
38
- row?: Boolean | RowProps & {
37
+ }>;
38
+ row?: Boolean | Partial<RowProps & {
39
39
  show?: Boolean;
40
- };
41
- info?: Boolean | VNodeRule & {
40
+ }>;
41
+ info?: Boolean | Partial<VNodeRule & {
42
42
  show?: Boolean;
43
43
  native?: Boolean;
44
44
  icon?: string;
45
45
  align?: 'left' | 'right';
46
46
  info?: string;
47
- };
48
- wrap?: Boolean | VNodeRule & {
47
+ }>;
48
+ wrap?: Boolean | Partial<VNodeRule & {
49
49
  labelWidth?: string
50
50
  required?: boolean
51
51
  error?: string
@@ -53,8 +53,8 @@ export interface OptionAttrs {
53
53
  inlineMessage?: boolean
54
54
  size?: ComponentSize
55
55
  show?: Boolean;
56
- };
57
- form?: {
56
+ }>;
57
+ form?: Partial<{
58
58
  inline?: boolean
59
59
  disabled?: boolean
60
60
  labelPosition?: string
@@ -67,29 +67,29 @@ export interface OptionAttrs {
67
67
  size?: ComponentSize
68
68
  className?: any;
69
69
  col?: Boolean;
70
- };
70
+ }>;
71
71
 
72
- submitBtn?: Boolean | ButtonProps & {
72
+ submitBtn?: Boolean | Partial<ButtonProps & {
73
73
  click?: Function;
74
74
  innerText?: string;
75
75
  show?: Boolean;
76
- };
76
+ }>;
77
77
 
78
- resetBtn?: Boolean | ButtonProps & {
78
+ resetBtn?: Boolean | Partial<ButtonProps & {
79
79
  click?: Function;
80
80
  innerText?: string;
81
81
  show?: Boolean;
82
- };
82
+ }>;
83
83
 
84
84
  }
85
85
 
86
- declare const optionAttrs: OptionAttrs & {
87
- title?: Boolean | VNodeRule & {
86
+ declare const optionAttrs: Partial<OptionAttrs & {
87
+ title?: Boolean | Partial<VNodeRule & {
88
88
  show?: Boolean;
89
89
  native?: Boolean;
90
90
  title: string;
91
- };
92
- };
91
+ }>;
92
+ }>;
93
93
 
94
94
  export interface CreatorAttrs {
95
95
  col(props: typeof optionAttrs.col): this;