@ttkj/avue 2.10.16 → 2.10.17

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@ttkj/avue",
3
- "version": "2.10.16",
3
+ "version": "2.10.17",
4
4
  "description": "A Magic Configurable Web Framework",
5
5
  "main": "lib/avue.min.js",
6
6
  "unpkg": "lib/avue.min.js",
7
7
  "jsdelivr": "lib/avue.min.js",
8
8
  "scripts": {
9
- "bootstrap": "yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org ",
10
- "gen:version": "node build/version.js",
9
+ "bootstrap": "yarn --registry https://registry.npmmirror.com || npm install --registry https://registry.npmmirror.com ",
11
10
  "analyz": "NODE_ENV=production npm_config_report=true npm run build",
12
- "dev": "yarn gen:version && cross-env TARGET=dev UINAME=element-ui gulp watch",
13
- "build": "yarn gen:version && cross-env TARGET=prod UINAME=element-ui gulp build",
11
+ "dev": "cross-env TARGET=dev UINAME=element-ui gulp watch",
12
+ "build": "cross-env TARGET=prod UINAME=element-ui gulp build",
14
13
  "all": "yarn build && yarn dev"
15
14
  },
16
15
  "typings": "types/index.d.ts",
@@ -3,6 +3,7 @@ import { RenderHeaderData, TableColumn, TableColumnFilter } from 'element-ui/typ
3
3
  import { PopoverPlacement } from 'element-ui/types/popover';
4
4
  import { AvueAlignment, Obj } from '../global';
5
5
  import { FormColumnEventParams, AvueFormBaseColumn, AvueFormColumn, FormColumnEvent } from '../form/column';
6
+ import { DynamicFormColumnChildren } from '../form/components/dynamic';
6
7
 
7
8
  /**
8
9
  * 表单项事件参数,适用于click|blur|focus
@@ -43,8 +44,8 @@ export interface CrudBaseColumn {
43
44
  showColumn?: boolean;
44
45
  /** 对应列是否可以排序,如果设置为 'custom',则代表用户希望远程排序,需要监听 Table 的 sort-change 事件, 默认: false */
45
46
  sortable?: boolean | 'custom';
46
- /** 子列配置 */
47
- children?: AvueCrudColumn[];
47
+ /** 子列配置或明细组件配置 */
48
+ children?: AvueCrudColumn[] | DynamicFormColumnChildren;
48
49
  /** 列标题 Label 区域渲染使用的 Function */
49
50
  renderHeader?: (h: CreateElement, data: RenderHeaderData) => VNode | string;
50
51
  /**
@@ -1,5 +1,6 @@
1
1
  import { PopoverPlacement } from 'element-ui/types/popover';
2
2
  import { AvueComponentSize, Obj, DicProps as BaseDicProps, DicHttpProps } from '../global';
3
+ import { DynamicFormColumn } from './components/dynamic';
3
4
 
4
5
  /** 表单项字典Props配置 */
5
6
  export interface DicProps extends BaseDicProps, DicHttpProps {}
@@ -79,14 +80,14 @@ export interface FormColumnEventParams {
79
80
  row: Obj;
80
81
  /** dic */
81
82
  dic: Obj[];
82
- /** 当表单项含dic时,根据选中值返回对应的dic项 */
83
+ /** 根据选中值返回对应的dic项, 对select/checkbox/radio/cascader/tree生效 */
83
84
  item?: Obj;
85
+ /** 同item,兼容配置 */
86
+ selected?: Obj;
84
87
  /** 表单项值的label,含dic时,为dic的label,否则为value的字符串格式 */
85
88
  label: string;
86
89
  /** 所在行索引,只在明细组件中生效 */
87
90
  index?: number;
88
- /** 选中选项,仅在下拉组件中生效 */
89
- selected?: Obj;
90
91
  }
91
92
 
92
93
  /** 表单项基本配置属性 */
@@ -0,0 +1,35 @@
1
+ // 引入定义
2
+ import { Obj } from '../../global';
3
+ import { CrudOption } from '../../crud/option';
4
+ import { AvueFormBaseColumn } from '../column';
5
+
6
+ /** 明细表单/表格配置 */
7
+ export interface DynamicFormColumnChildren extends CrudOption {
8
+ /** 类型,表格: 'crud' 表单: 'form', 默认: 'crud' */
9
+ type?: 'form' | 'crud';
10
+ }
11
+
12
+ /** 明细组件自定义配置 */
13
+ export interface FormColumnDynamic {
14
+ // ========== props ==========
15
+ /** 列类型 */
16
+ type?: 'dynamic';
17
+ /** 默认值 */
18
+ value?: Obj[];
19
+ /**
20
+ * 最小值, 不得小于0
21
+ * @description 当最小值大于最大值时,最小值取最大值
22
+ */
23
+ min?: number;
24
+ /** 最大值, 不得小于0 */
25
+ max?: number;
26
+ /** 输入时是否触发表单的校验, 默认: false */
27
+ validateEvent?: boolean;
28
+ /** 明细表单/表格配置 */
29
+ children: DynamicFormColumnChildren;
30
+ }
31
+
32
+ export interface DynamicFormColumn<T = Obj> extends AvueFormBaseColumn<T> {
33
+ /** 其他配置 */
34
+ [x: string]: any;
35
+ }