@lambo-design/variant-form 2.2.9-beta.0 → 2.2.9-beta.1

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 (66) hide show
  1. package/README.md +201 -0
  2. package/babel.config.js +5 -0
  3. package/dist/lib/VFormDesigner.common-report.html +53 -0
  4. package/dist/lib/VFormDesigner.common.js +123773 -0
  5. package/dist/lib/VFormDesigner.common.js.map +1 -0
  6. package/dist/lib/VFormDesigner.css +1 -0
  7. package/dist/lib/VFormDesigner.umd-report.html +53 -0
  8. package/dist/lib/VFormDesigner.umd.js +123783 -0
  9. package/dist/lib/VFormDesigner.umd.js.map +1 -0
  10. package/dist/lib/VFormDesigner.umd.min-report.html +53 -0
  11. package/dist/lib/VFormDesigner.umd.min.js +222 -0
  12. package/dist/lib/demo.html +10 -0
  13. package/dist/lib/img/indicator-card-header.7291bcc9.png +0 -0
  14. package/dist/lib/img/lan_navigator.53090c9d.png +0 -0
  15. package/dist/lib/img/layout-header-bg-canglan.b1d97e4e.png +0 -0
  16. package/dist/lib/img/layout-header-bg-cuiwei.67019b6d.png +0 -0
  17. package/dist/lib/img/lv_navigator.f07fb393.png +0 -0
  18. package/index_template/index_dev.html +19 -0
  19. package/index_template/index_prod.html +28 -0
  20. package/install-render.js +29 -0
  21. package/install.js +41 -0
  22. package/jsconfig.json +10 -0
  23. package/license.txt +8 -0
  24. package/package.json +10 -4
  25. package/public/favicon.ico +0 -0
  26. package/public/index.html +19 -0
  27. package/src/App.vue +45 -0
  28. package/src/components/form-designer/designer.js +1 -0
  29. package/src/components/form-designer/form-widget/field-widget/organ-select-widget.vue +254 -0
  30. package/src/components/form-designer/form-widget/field-widget/relation-form-widget.vue +397 -0
  31. package/src/components/form-designer/form-widget/field-widget/sub-form-widget.vue +660 -0
  32. package/src/components/form-designer/form-widget/field-widget/user-select-widget.vue +333 -0
  33. package/src/components/form-designer/form-widget/index.vue +1 -1
  34. package/src/components/form-designer/index.vue +14 -12
  35. package/src/components/form-designer/setting-panel/form-setting.vue +59 -60
  36. package/src/components/form-designer/setting-panel/index.vue +2 -0
  37. package/src/components/form-designer/setting-panel/property-editor/allowMultiple-editor.vue +24 -0
  38. package/src/components/form-designer/setting-panel/property-editor/border-editor.vue +1 -1
  39. package/src/components/form-designer/setting-panel/property-editor/buttonStyle-editor.vue +1 -1
  40. package/src/components/form-designer/setting-panel/property-editor/clearable-editor.vue +1 -1
  41. package/src/components/form-designer/setting-panel/property-editor/displayFields-editor.vue +91 -0
  42. package/src/components/form-designer/setting-panel/property-editor/displayStyle-editor.vue +1 -1
  43. package/src/components/form-designer/setting-panel/property-editor/field-relation-form/relation-form-defaultValue-editor.vue +18 -0
  44. package/src/components/form-designer/setting-panel/property-editor/filterable-editor.vue +1 -1
  45. package/src/components/form-designer/setting-panel/property-editor/multipleLimit-editor.vue +1 -1
  46. package/src/components/form-designer/setting-panel/property-editor/name-editor.vue +2 -2
  47. package/src/components/form-designer/setting-panel/property-editor/operList-editor.vue +64 -0
  48. package/src/components/form-designer/setting-panel/property-editor/placeholder-editor.vue +1 -1
  49. package/src/components/form-designer/setting-panel/property-editor/relationForm-editor.vue +74 -0
  50. package/src/components/form-designer/setting-panel/property-editor/relationItems-editor.vue +91 -0
  51. package/src/components/form-designer/setting-panel/property-editor/relationType-editor.vue +67 -0
  52. package/src/components/form-designer/setting-panel/property-editor/rootOrgan-editor.vue +248 -0
  53. package/src/components/form-designer/setting-panel/property-editor/size-editor.vue +5 -5
  54. package/src/components/form-designer/setting-panel/property-editor/subFormId-editor.vue +74 -0
  55. package/src/components/form-designer/setting-panel/propertyRegister.js +144 -133
  56. package/src/components/form-designer/toolbar-panel/index.vue +11 -10
  57. package/src/components/form-designer/widget-panel/index.vue +11 -11
  58. package/src/components/form-designer/widget-panel/widgetsConfig.js +425 -297
  59. package/src/extension/extension-loader.js +1 -1
  60. package/src/icons/svg/relation-form-field.svg +1 -0
  61. package/src/lang/en-US.js +39 -0
  62. package/src/lang/zh-CN.js +42 -3
  63. package/src/main.js +29 -0
  64. package/src/utils/config.js +1 -1
  65. package/src/utils/util.js +35 -1
  66. package/vue.config.js +93 -0
@@ -28,7 +28,7 @@ export const loadExtension = function () {
28
28
  * 4. 注册容器组件的代码生成器;
29
29
  * 5. 加载完毕。
30
30
  */
31
- addContainerWidgetSchema(cardSchema) //加载组件Json Schema
31
+ // addContainerWidgetSchema(cardSchema) //加载组件Json Schema
32
32
  /* -------------------------------------------------- */
33
33
  Vue.component(CardWidget.name, CardWidget) //注册设计期的容器组件
34
34
  Vue.component(CardItem.name, CardItem) //注册运行期的容器组件
@@ -0,0 +1 @@
1
+ <?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1615359824945" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="66338" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M661.377376 411.069935V475.664516H314.175312v395.654882h557.144086V475.664516h-48.447312V411.069935h48.447312c35.674839 0 64.594581 28.919742 64.59458 64.594581v395.654882c0 35.674839-28.919742 64.594581-64.59458 64.59458h-557.144086c-35.674839 0-64.600086-28.919742-64.600086-64.59458V475.664516c0-35.674839 28.925247-64.594581 64.600086-64.594581h347.202064z m48.447312-322.983913c35.674839 0 64.600086 28.919742 64.600086 64.59458v403.731269c0 35.674839-28.925247 64.594581-64.600086 64.594581H362.622624v-64.594581h347.202064V152.680602h-557.144086v403.731269h48.447312V621.006452h-48.447312c-35.674839 0-64.594581-28.919742-64.59458-64.594581V152.680602C88.086022 117.005763 117.005763 88.086022 152.680602 88.086022h557.144086z" p-id="66339"></path></svg>
package/src/lang/en-US.js CHANGED
@@ -52,8 +52,12 @@ export default {
52
52
  button: 'Button',
53
53
  divider: 'Divider',
54
54
 
55
+ 'relation-form': 'RelationForm',
56
+
55
57
  'picture-upload': 'Picture',
56
58
  'file-upload': 'File',
59
+ 'organ-select': 'Organ',
60
+ 'user-select': 'User',
57
61
  'rich-editor': 'Rich Editor',
58
62
  cascader: 'Cascader',
59
63
  slot: 'Slot',
@@ -116,6 +120,7 @@ export default {
116
120
 
117
121
  widgetSetting: 'Widget Config',
118
122
  formSetting: 'Form Config',
123
+ dataModelSetting: 'Data Model Setting',
119
124
 
120
125
  prompt: 'Prompt',
121
126
  confirm: 'OK',
@@ -177,6 +182,11 @@ export default {
177
182
  endPlaceholder: 'End Placeholder',
178
183
  widgetColumnWidth: 'Width',
179
184
  widgetSize: 'Size',
185
+ sizeDefault: 'Default',
186
+ sizeLarge: 'Large',
187
+ // sizeMedium: 'Medium',
188
+ sizeSmall: 'Small',
189
+ // sizeMini: 'Mini',
180
190
  fontSize: 'Font Size',
181
191
  textAlign: 'Text Align',
182
192
  showStops: 'Show Stops',
@@ -186,6 +196,8 @@ export default {
186
196
  buttonStyle: 'Show As Button',
187
197
  border: 'Show Border',
188
198
  labelWidth: 'Width Of Label',
199
+ rootOrgan: 'Root Organ',
200
+ allowMultiple: 'allow multiple',
189
201
  rows: 'Rows',
190
202
  labelHidden: 'Hide Label',
191
203
  required: 'Required',
@@ -306,6 +318,7 @@ export default {
306
318
  labelPosition: 'Position Of Label',
307
319
  topPosition: 'Top',
308
320
  leftPosition: 'Left',
321
+ rightPosition: 'Right',
309
322
  labelAlign: 'Label Align',
310
323
  leftAlign: 'Left',
311
324
  centerAlign: 'Center',
@@ -348,6 +361,32 @@ export default {
348
361
  addTableColumn: 'Add New Column',
349
362
  deleteTableColumn: 'Delete This Column',
350
363
  OnlyOneColumnCannotBeDeleted: 'The last column cannot be deleted.',
364
+
365
+ relationForm: 'Relation Form',
366
+ relationItems: 'Relation Items',
367
+ relationType: 'Relation Type',
368
+ relationSelect: 'Select',
369
+ relationList: 'List',
370
+ relationHelp: 'Help',
371
+ relationValue: 'Relation Value',
372
+ relationLabel: 'Relation Label',
373
+
374
+ operList: 'Action Buttons',
375
+ subFormId: 'Sub Form Id',
376
+ displayFields: 'Display Fields',
377
+ actions: {
378
+ insert: 'Insert',
379
+ edit: 'Edit',
380
+ delete: 'Delete',
381
+ copy: 'Copy',
382
+ draggable: 'Draggable',
383
+ batchDelete: 'Batch Delete',
384
+ detail: 'Detail',
385
+ },
386
+ batchDeleteConfirm: 'Batch Delete Confirm',
387
+
388
+ tableName: 'Table Name',
389
+ tableDescription: 'Table Description'
351
390
  }
352
391
 
353
392
  }
package/src/lang/zh-CN.js CHANGED
@@ -52,8 +52,12 @@ export default {
52
52
  button: '按钮',
53
53
  divider: '分隔线',
54
54
 
55
+ 'relation-form': '关联表单',
56
+
55
57
  'picture-upload': '图片',
56
58
  'file-upload': '文件',
59
+ 'organ-select': '组织',
60
+ 'user-select': '用户',
57
61
  'rich-editor': '富文本',
58
62
  cascader: '级联选择',
59
63
  slot: '插槽',
@@ -116,6 +120,7 @@ export default {
116
120
 
117
121
  widgetSetting: '组件设置',
118
122
  formSetting: '表单设置',
123
+ dataModelSetting: '数据模型设置',
119
124
 
120
125
  prompt: '提示',
121
126
  confirm: '确定',
@@ -177,6 +182,11 @@ export default {
177
182
  endPlaceholder: '截止占位内容',
178
183
  widgetColumnWidth: '组件列宽',
179
184
  widgetSize: '组件大小',
185
+ sizeDefault: '默认',
186
+ sizeLarge: '大',
187
+ // sizeMedium: '中',
188
+ sizeSmall: '小',
189
+ // sizeMini: '迷你',
180
190
  fontSize: '字体大小',
181
191
  textAlign: '文字对齐',
182
192
  showStops: '显示间断点',
@@ -186,11 +196,13 @@ export default {
186
196
  buttonStyle: '显示为按钮',
187
197
  border: '带有边框',
188
198
  labelWidth: '标签宽度',
199
+ rootOrgan: '根组织',
200
+ allowMultiple: '允许多选',
189
201
  rows: '行数',
190
202
  labelHidden: '隐藏字段标签',
191
203
  required: '必填字段',
192
- validation: '字段校验',
193
204
  requiredHint: '必填校验提示',
205
+ validation: '字段校验',
194
206
  validationHelp: '支持输入正则表达式',
195
207
  validationHint: '校验失败提示',
196
208
  readonly: '只读',
@@ -303,9 +315,10 @@ export default {
303
315
 
304
316
  widgetName: '组件唯一名称',
305
317
  formSize: '全局组件大小',
306
- labelPosition: '字段标签位置',
318
+ labelPosition: '对齐方式',
307
319
  topPosition: '顶部',
308
320
  leftPosition: '左边',
321
+ rightPosition: '右边',
309
322
  labelAlign: '标签对齐',
310
323
  leftAlign: '居左',
311
324
  centerAlign: '居中',
@@ -332,8 +345,8 @@ export default {
332
345
  smallPagination: '小型分页',
333
346
  tableColEdit: '表格列编辑',
334
347
  tableDataEdit: '表格数据编辑',
335
- showSummary: '是否合计',
336
348
  stripe: '是否斑马线',
349
+ showSummary: '是否合计',
337
350
  rowSpacing: '行距(px)',
338
351
  editAction: '编辑...',
339
352
  columnName: '字段名称',
@@ -348,6 +361,32 @@ export default {
348
361
  addTableColumn: '增加列',
349
362
  deleteTableColumn: '删除列',
350
363
  OnlyOneColumnCannotBeDeleted: '表格只有一列时不可删除.',
364
+
365
+ relationForm: '关联表单',
366
+ relationItems: '关联表单项',
367
+ relationType: '关联表单样式',
368
+ relationSelect: '下拉选项',
369
+ relationList: '列表选项',
370
+ relationHelp: '弹出选项',
371
+ relationValue: '关联数据编码',
372
+ relationLabel: '关联数据标签',
373
+
374
+ operList: '操作功能',
375
+ subFormId: '子表单',
376
+ displayFields: '展示表单项',
377
+ actions: {
378
+ insert: '新增',
379
+ edit: '编辑',
380
+ delete: '删除',
381
+ copy: '复制',
382
+ draggable: '拖动',
383
+ batchDelete: '批量删除',
384
+ detail: '详情',
385
+ },
386
+ batchDeleteConfirm: '确定批量删除吗',
387
+
388
+ tableName: '物理表名称',
389
+ tableDescription: '物理表描述'
351
390
  }
352
391
 
353
392
  }
package/src/main.js ADDED
@@ -0,0 +1,29 @@
1
+ import 'babel-polyfill'
2
+ import './utils/debug-console'
3
+ import Vue from 'vue'
4
+ import axios from "axios";
5
+ import App from './App.vue'
6
+ import ElementUI from 'element-ui'
7
+ import './utils/directive'
8
+ import './icons'
9
+
10
+ import 'element-ui/lib/theme-chalk/index.css'
11
+ import '@/styles/index.scss'
12
+ import '@/iconfont/iconfont.css'
13
+
14
+ import {loadExtension} from '@/extension/extension-loader'
15
+
16
+ loadExtension()
17
+
18
+ Vue.use(ElementUI, { size: 'small' })
19
+
20
+ if (typeof window !== 'undefined') {
21
+ window.axios = axios
22
+ }
23
+
24
+ Vue.config.productionTip = false
25
+
26
+ new Vue({
27
+ el: "#app",
28
+ render: h => h(App),
29
+ })
@@ -1,4 +1,4 @@
1
- export const VARIANT_FORM_VERSION = '2.2.9'
1
+ export const VARIANT_FORM_VERSION = '1.0.0'
2
2
 
3
3
  //export const MOCK_CASE_URL = 'https://www.fastmock.site/mock/2de212e0dc4b8e0885fea44ab9f2e1d0/vform/'
4
4
  export const MOCK_CASE_URL = 'https://ks3-cn-beijing.ksyuncs.com/vform-static/vcase/'
package/src/utils/util.js CHANGED
@@ -14,7 +14,33 @@ export function isEmptyStr(str) {
14
14
  }
15
15
 
16
16
  export const generateId = function() {
17
- return Math.floor(Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000);
17
+ //1、原算法
18
+ //结果范围:最小值:0 + 0 + 0 = 0,最大值:99999 + 19999 + 4999 ≈ 125000,实际结果范围:0-124997(因为Math.floor会向下取整)
19
+ //由于是三个独立随机数相加,结果会呈现近似正态分布,中间值出现的概率高于极端值
20
+ // return Math.floor(Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000);
21
+ //1.2、如果需要更精确的范围控制,建议使用单个Math.random()乘以目标范围,生成特定范围的随机数,6位
22
+ // let min=100000,max=1000000;
23
+ // return Math.floor(Math.random() * (max - min + 1)) + min;
24
+ //1.3、结合时间戳增加随机性的随机数,增强动态混合算法,6位以内,强制填充到6位
25
+ return Math.floor(((Math.random() * (Date.now() % 1000) ) % 1 ) * 1000000).toString().padStart(6, '0');
26
+ //1.4、密码学安全组合,10位
27
+ // const crypto = window.crypto || window.msCrypto;
28
+ // const array = new Uint32Array(1);
29
+ // crypto.getRandomValues(array); // 密码学安全随机数
30
+ // return (array[0] ^ Date.now()) >>> 0; // 无符号右移确保正整数
31
+ //1.5、使用Math.random()生成包含0-9和a-z字符的具有合理唯一性的随机ID字符串,适用于需要临时或者独特标识符场景,9位
32
+ // return Math.random().toString(36).substr(2,9);
33
+ //1.5.1、注:new Date().getTime().toString(36)可以将时间戳从13位转换为8位的包含0-9和a-z的字符串
34
+ //2、借鉴generateUniqueId方法,18位太长了
35
+ // const timestamp = Date.now(); // 当前时间的时间戳(以毫秒为单位)
36
+ // const randomNum = Math.floor(Math.random() * 10000); // 0 到 9999 的随机数
37
+ // return `${timestamp}${randomNum}`; // 将时间戳和随机数拼接
38
+ };
39
+
40
+ export const generateUniqueId = function() {
41
+ const timestamp = Date.now(); // 当前时间的时间戳(以毫秒为单位)
42
+ const randomNum = Math.floor(Math.random() * 10000); // 0 到 9999 的随机数
43
+ return `${timestamp}${randomNum}`; // 将时间戳和随机数拼接
18
44
  };
19
45
 
20
46
  export const deepClone = function (origin) {
@@ -367,6 +393,14 @@ export function getDefaultFormConfig() {
367
393
  onFormDataChange: '',
368
394
  }
369
395
  }
396
+ function generateUUID() {
397
+ const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
398
+ let uuid = '';
399
+ for (let i = 0; i < 9; i++) { // 生成9个随机字符
400
+ uuid += chars[Math.floor(Math.random() * chars.length)];
401
+ }
402
+ return uuid;
403
+ }
370
404
 
371
405
  export function buildDefaultFormJson() {
372
406
  return {
package/vue.config.js ADDED
@@ -0,0 +1,93 @@
1
+ 'use strict'
2
+
3
+ const path = require('path')
4
+ const IS_PROD = process.env.NODE_ENV === 'production'
5
+
6
+ function resolve (dir) {
7
+ return path.join(__dirname, dir)
8
+ }
9
+
10
+ const npmConfigArgv = (process.env.npm_config_argv === undefined) ? null : JSON.parse(process.env.npm_config_argv)
11
+ /*
12
+ console.log('npm config: ', npmConfigArgv)
13
+ const procArgv = process.argv
14
+ console.log('npm config: ', procArgv)
15
+ */
16
+ let buildProdFlag = false
17
+ if (!!npmConfigArgv) {
18
+ npmConfigArgv.original.forEach(cItem => {
19
+ if (cItem === 'build') {
20
+ buildProdFlag = true
21
+ }
22
+ })
23
+ }
24
+
25
+ const mvdir = require('mvdir');
26
+ if (IS_PROD && buildProdFlag) {
27
+ mvdir('index_template/index_prod.html', 'public/index.html', { copy: true });
28
+ } else {
29
+ mvdir('index_template/index_dev.html', 'public/index.html', { copy: true });
30
+ }
31
+
32
+
33
+ module.exports = {
34
+ publicPath: './',
35
+ assetsDir: './',
36
+
37
+ /* 开启vue运行时模板编译功能!! */
38
+ runtimeCompiler: true,
39
+
40
+ lintOnSave: false,
41
+
42
+ productionSourceMap: false,
43
+
44
+ /* 指定node_modules目录中需要做babel转译的依赖库 */
45
+ transpileDependencies: [
46
+ 'element-ui', 'vuedraggable',
47
+ ],
48
+
49
+ css: {
50
+ loaderOptions: {
51
+ scss: {
52
+ /* 自动引入全局scss文件 */
53
+ prependData: `
54
+ @import "./src/styles/global.scss";
55
+ `
56
+ }
57
+ }
58
+ },
59
+
60
+ configureWebpack: (config) => {
61
+ config.devtool = 'source-map'
62
+ config.output.libraryExport = 'default' /* 解决import UMD打包文件时, 组件install方法执行报错的问题!! */
63
+
64
+ if (IS_PROD && buildProdFlag) { /* 仅生产环境使用 */
65
+ /* CDN打包,需要修改index.html加入CDN资源 */
66
+ config.externals = {
67
+ 'vue': 'Vue',
68
+ 'element-ui': 'ELEMENT',
69
+ //'quill': 'Quill',
70
+ }
71
+ }
72
+ },
73
+
74
+ chainWebpack: config => {
75
+ /* 配置svg图标自动加载 begin */
76
+ config.module
77
+ .rule('svg')
78
+ .exclude.add(resolve('src/icons'))
79
+ .end()
80
+ config.module
81
+ .rule('icons')
82
+ .test(/\.svg$/)
83
+ .include.add(resolve('src/icons'))
84
+ .end()
85
+ .use('svg-sprite-loader')
86
+ .loader('svg-sprite-loader')
87
+ .options({
88
+ symbolId: 'icon-[name]'
89
+ })
90
+ /* 配置svg图标自动加载 end */
91
+ },
92
+
93
+ }