@aplus-frontend/ui 0.0.10 → 0.0.12

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 (55) hide show
  1. package/es/src/ap-action/item/index.vue2.mjs +21 -20
  2. package/es/src/ap-action/style/item.css +20 -5
  3. package/es/src/ap-field/checkbox/index.vue.mjs +1 -1
  4. package/es/src/ap-field/date/index.vue.mjs +1 -1
  5. package/es/src/ap-field/date-range/index.vue.mjs +1 -1
  6. package/es/src/ap-field/number/index.vue.mjs +1 -1
  7. package/es/src/ap-field/radio/index.vue.mjs +1 -1
  8. package/es/src/ap-field/select/index.vue.mjs +1 -1
  9. package/es/src/ap-field/slider/index.vue.d.ts +3 -0
  10. package/es/src/ap-field/slider/index.vue.mjs +4 -4
  11. package/es/src/ap-field/switch/index.vue.mjs +1 -1
  12. package/es/src/ap-field/text/index.vue2.mjs +1 -1
  13. package/es/src/ap-field/text/password.vue.mjs +1 -1
  14. package/es/src/ap-field/text-area/index.vue.mjs +1 -1
  15. package/es/src/ap-form/ap-form.vue2.mjs +27 -27
  16. package/es/src/ap-form/modal-form/index.vue.mjs +104 -104
  17. package/es/src/ap-form/style/modal-form.css +5 -1
  18. package/es/src/ap-table/ap-table.vue.d.ts +2 -3
  19. package/es/src/ap-table/ap-table.vue.mjs +95 -91
  20. package/es/src/ap-table/interface.d.ts +1 -1
  21. package/es/src/editable-table/interface.d.ts +73 -0
  22. package/es/src/editable-table/style/index.css +11 -0
  23. package/es/src/editable-table/utils.d.ts +8 -0
  24. package/es/src/pro-form/components/form-action.vue2.mjs +8 -8
  25. package/es/src/theme/ap-action/item.css +20 -5
  26. package/es/src/theme/ap-form/modal-form.css +5 -1
  27. package/es/src/theme/editable-table/index.css +11 -0
  28. package/lib/src/ap-action/item/index.vue2.js +1 -1
  29. package/lib/src/ap-action/style/item.css +20 -5
  30. package/lib/src/ap-field/checkbox/index.vue.js +1 -1
  31. package/lib/src/ap-field/date/index.vue.js +1 -1
  32. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  33. package/lib/src/ap-field/number/index.vue.js +1 -1
  34. package/lib/src/ap-field/radio/index.vue.js +1 -1
  35. package/lib/src/ap-field/select/index.vue.js +1 -1
  36. package/lib/src/ap-field/slider/index.vue.d.ts +3 -0
  37. package/lib/src/ap-field/slider/index.vue.js +1 -1
  38. package/lib/src/ap-field/switch/index.vue.js +1 -1
  39. package/lib/src/ap-field/text/index.vue2.js +1 -1
  40. package/lib/src/ap-field/text/password.vue.js +1 -1
  41. package/lib/src/ap-field/text-area/index.vue.js +1 -1
  42. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  43. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  44. package/lib/src/ap-form/style/modal-form.css +5 -1
  45. package/lib/src/ap-table/ap-table.vue.d.ts +2 -3
  46. package/lib/src/ap-table/ap-table.vue.js +1 -1
  47. package/lib/src/ap-table/interface.d.ts +1 -1
  48. package/lib/src/editable-table/interface.d.ts +73 -0
  49. package/lib/src/editable-table/style/index.css +11 -0
  50. package/lib/src/editable-table/utils.d.ts +8 -0
  51. package/lib/src/pro-form/components/form-action.vue2.js +1 -1
  52. package/lib/src/theme/ap-action/item.css +20 -5
  53. package/lib/src/theme/ap-form/modal-form.css +5 -1
  54. package/lib/src/theme/editable-table/index.css +11 -0
  55. package/package.json +1 -1
@@ -62,7 +62,7 @@ export type ExtraProColumnType<T> = Omit<ColumnType<T>, 'children' | 'filters'>
62
62
  multiple?: number;
63
63
  };
64
64
  };
65
- export type ApColumnType<ValueType extends keyof ApTableValueFields = 'text', RecordType = any> = ExtraProColumnType<any> & {
65
+ export type ApColumnType<ValueType extends keyof ApTableValueFields = 'text', RecordType = any> = ExtraProColumnType<RecordType> & {
66
66
  children?: ApColumnType<any, RecordType>[];
67
67
  /**
68
68
  * 表单项所占据的格子数(1-24格)
@@ -0,0 +1,73 @@
1
+ import { ColumnType, TableProps } from 'ant-design-vue/es/table';
2
+ import { ApTableValueFields, ValueEnum } from '../ap-table';
3
+ import { InternalNamePath, NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
4
+
5
+ export type EditableColumnType<ValueType extends keyof ApTableValueFields = 'text', RecordType = any> = Omit<ColumnType<RecordType>, 'children'> & {
6
+ /**
7
+ * 在title之后展示一个icon并触发tooltip
8
+ */
9
+ tooltip?: string;
10
+ /**
11
+ * 是否可以复制(不可编辑模式下可用)
12
+ */
13
+ copyable?: boolean;
14
+ /**
15
+ * 是否可编辑
16
+ */
17
+ editable?: boolean | ((text: any, record: RecordType, index: number) => boolean);
18
+ /**
19
+ * 值的枚举,会自动转化把值当成 key 来取出要显示的内容(也会作为select等组件的选项)
20
+ */
21
+ valueEnum?: ValueEnum;
22
+ /**
23
+ * 自定义表单
24
+ */
25
+ customRenderFormItem?: (config: EditableColumnType<ValueType, RecordType>) => any;
26
+ /**
27
+ * 指定值类型(将会用于普通列和可编辑表格的渲染)
28
+ */
29
+ valueType?: keyof ApTableValueFields;
30
+ /**
31
+ * 值类型额外配置的参数(支持函数)
32
+ */
33
+ fieldProps?: ApTableValueFields[ValueType] | ((opt?: {
34
+ value: any;
35
+ text: any;
36
+ record: RecordType;
37
+ index: number;
38
+ renderIndex: number;
39
+ column: EditableColumnType<ValueType, RecordType>;
40
+ }) => ApTableValueFields[ValueType]);
41
+ };
42
+ export type EditableTableProps<RecordType = any> = Omit<TableProps<RecordType>, 'columns' | 'dataSource'> & {
43
+ /**
44
+ * 列配置
45
+ */
46
+ columns?: EditableColumnType<any, RecordType>[];
47
+ /**
48
+ * 同dataSource,传入的数组数据将作为表单的初始数据
49
+ */
50
+ value?: RecordType[];
51
+ 'onUpdate:value'?: (value: RecordType[]) => void;
52
+ /**
53
+ * 数据修改时触发onChange(也包含数据的删除)
54
+ * @param value
55
+ * @returns
56
+ */
57
+ onChange?: (value: RecordType[]) => void;
58
+ /**
59
+ * 表格最大行数,超过行后将无法调用相关API新增
60
+ */
61
+ maxLength?: number;
62
+ /**
63
+ * 设置可编辑表格的名字,如果是作为其它表单的一部分,需要设置此字段
64
+ */
65
+ name?: any;
66
+ };
67
+ export type EditableTableExpose<ModelType = any> = {
68
+ resetFields: (name?: NamePath) => void;
69
+ validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType>> | undefined;
70
+ getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<ModelType> | undefined;
71
+ add: (defaultValue?: any) => void;
72
+ remove: (index: number) => void;
73
+ };
@@ -0,0 +1,11 @@
1
+ .aplus-editable-table .ant-table-cell:has(> .ant-form-item) {
2
+ padding-top: 20px !important;
3
+ padding-bottom: 0 !important;
4
+ }
5
+ .aplus-editable-table .ant-form-item {
6
+ margin-bottom: 20px;
7
+ }
8
+ .aplus-editable-table__header-cell--required {
9
+ color: #FF4D4F;
10
+ padding-right: 2px;
11
+ }
@@ -0,0 +1,8 @@
1
+ import { EditableColumnType } from './interface';
2
+
3
+ /**
4
+ * 获取编辑模式下默认映射的组件
5
+ * @param valueType
6
+ * @returns
7
+ */
8
+ export declare function getEditableComponent(valueType: EditableColumnType['valueType']): any;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("ant-design-vue"),r=require("../../base-button/index.js"),v=require("../../basic/index.js"),h=require("../hooks/use-form-context.js");require("../../config-provider/index.js");require("./style/form-action.css");const k=require("../../config-provider/hooks/use-global-config.js"),x=require("../../config-provider/hooks/use-locale.js"),A=require("../../config-provider/hooks/use-namespace.js"),b=e.defineComponent({name:"BasicFormAction",__name:"form-action",props:{showActionButtonGroup:{type:Boolean,default:!0},showResetButton:{type:Boolean,default:!0},showSubmitButton:{type:Boolean,default:!0},showAdvancedButton:{type:Boolean,default:!0},resetButtonOptions:{default:()=>({})},submitButtonOptions:{},actionColOptions:{default:()=>({})},actionSpan:{default:6},isAdvanced:{type:Boolean},hideAdvanceBtn:{type:Boolean}},emits:["toggle-advanced"],setup(i,{emit:d}){const n=i,p=d,m=k.useGlobalConfig("uiMode"),B=e.computed(()=>m.value==="aplus"?{}:{color:"#34b77c"}),{t:o}=x.useLocale(),{em:s}=A.useNamespace("form-action"),{resetAction:f,submitAction:y}=h.useFormContext(),a=e.computed(()=>{const{actionColOptions:t}=n;return{style:{textAlign:"right",flex:1,maxWidth:"100%",minWidth:"25%"},...t}}),u=e.computed(()=>Object.assign({text:o("ap.common.resetText")},n.resetButtonOptions)),l=e.computed(()=>Object.assign({text:o("ap.common.queryText")},n.submitButtonOptions));function C(){p("toggle-advanced")}return(t,g)=>t.showActionButtonGroup?(e.openBlock(),e.createBlock(e.unref(c.Col),e.normalizeProps(e.mergeProps({key:0},a.value)),{default:e.withCtx(()=>[e.createElementVNode("div",{style:e.normalizeStyle([{width:"100%"},{textAlign:a.value.style.textAlign}])},[e.createVNode(e.unref(c.Form).Item,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"resetBefore"),t.showResetButton?(e.openBlock(),e.createBlock(e.unref(r.BaseButton),e.mergeProps({key:0,type:"default",class:e.unref(s)("button","space")},u.value,{onClick:e.unref(f)}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.value.text),1)]),_:1},16,["class","onClick"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"submitBefore"),t.showSubmitButton?(e.openBlock(),e.createBlock(e.unref(r.BaseButton),e.mergeProps({key:1,type:"primary",class:e.unref(s)("button","space")},l.value,{onClick:e.unref(y)}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.text),1)]),_:1},16,["class","onClick"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"advanceBefore"),t.showAdvancedButton&&!t.hideAdvanceBtn?(e.openBlock(),e.createBlock(e.unref(r.BaseButton),{key:2,type:"link",size:"small",style:e.normalizeStyle(B.value),onClick:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.isAdvanced?e.unref(o)("ap.common.closeText"):e.unref(o)("ap.common.expandText"))+" ",1),e.createVNode(e.unref(v.BasicArrow),{class:e.normalizeClass(e.unref(s)("item","space")),expand:!t.isAdvanced,up:""},null,8,["class","expand"])]),_:1},8,["style"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"advanceAfter")]),_:3})],4)]),_:3},16)):e.createCommentVNode("",!0)}});exports.default=b;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("ant-design-vue"),r=require("../../base-button/index.js"),v=require("../../basic/index.js"),h=require("../hooks/use-form-context.js");require("../../config-provider/index.js");require("./style/form-action.css");const k=require("../../config-provider/hooks/use-global-config.js"),x=require("../../config-provider/hooks/use-locale.js"),A=require("../../config-provider/hooks/use-namespace.js"),b=e.defineComponent({name:"BasicFormAction",__name:"form-action",props:{showActionButtonGroup:{type:Boolean,default:!0},showResetButton:{type:Boolean,default:!0},showSubmitButton:{type:Boolean,default:!0},showAdvancedButton:{type:Boolean,default:!0},resetButtonOptions:{default:()=>({})},submitButtonOptions:{},actionColOptions:{default:()=>({})},actionSpan:{default:6},isAdvanced:{type:Boolean},hideAdvanceBtn:{type:Boolean}},emits:["toggle-advanced"],setup(i,{emit:d}){const n=i,p=d,m=k.useGlobalConfig("uiMode"),B=e.computed(()=>m.value==="aplus"?{}:{color:"#34b77c"}),{t:o}=x.useLocale(),{em:s}=A.useNamespace("form-action"),{resetAction:f,submitAction:y}=h.useFormContext(),a=e.computed(()=>{const{actionColOptions:t}=n;return{style:{textAlign:"right",flex:1,maxWidth:"100%",minWidth:"25%"},...t}}),u=e.computed(()=>Object.assign({text:o("ap.common.resetText")},n.resetButtonOptions)),l=e.computed(()=>Object.assign({text:o("ap.common.queryText")},n.submitButtonOptions));function C(){p("toggle-advanced")}return(t,g)=>t.showActionButtonGroup?(e.openBlock(),e.createBlock(e.unref(c.Col),e.normalizeProps(e.mergeProps({key:0},a.value)),{default:e.withCtx(()=>[e.createElementVNode("div",{style:e.normalizeStyle([{width:"100%"},{textAlign:a.value.style.textAlign}])},[e.createVNode(e.unref(c.Form).Item,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"resetBefore"),t.showSubmitButton?(e.openBlock(),e.createBlock(e.unref(r.BaseButton),e.mergeProps({key:0,type:"primary",class:e.unref(s)("button","space")},l.value,{onClick:e.unref(y)}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value.text),1)]),_:1},16,["class","onClick"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"submitBefore"),t.showResetButton?(e.openBlock(),e.createBlock(e.unref(r.BaseButton),e.mergeProps({key:1,type:"default",class:e.unref(s)("button","space")},u.value,{onClick:e.unref(f)}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.value.text),1)]),_:1},16,["class","onClick"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"advanceBefore"),t.showAdvancedButton&&!t.hideAdvanceBtn?(e.openBlock(),e.createBlock(e.unref(r.BaseButton),{key:2,type:"link",size:"small",style:e.normalizeStyle(B.value),onClick:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.isAdvanced?e.unref(o)("ap.common.closeText"):e.unref(o)("ap.common.expandText"))+" ",1),e.createVNode(e.unref(v.BasicArrow),{class:e.normalizeClass(e.unref(s)("item","space")),expand:!t.isAdvanced,up:""},null,8,["class","expand"])]),_:1},8,["style"])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"advanceAfter")]),_:3})],4)]),_:3},16)):e.createCommentVNode("",!0)}});exports.default=b;
@@ -4,21 +4,36 @@
4
4
  line-height: 22px;
5
5
  cursor: pointer;
6
6
  }
7
- .aplus-action-item--primary {
7
+ .aplus-action-item-aplus--primary {
8
8
  color: #0070ff;
9
9
  }
10
- .aplus-action-item--primary:not(.aplus-action-item--disabled):hover {
10
+ .aplus-action-item-aplus--primary:not(.aplus-action-item--disabled):hover {
11
11
  color: #66a9ff;
12
12
  }
13
- .aplus-action-item--success {
13
+ .aplus-action-item-admin--primary {
14
+ color: #1890FF;
15
+ }
16
+ .aplus-action-item-admin--primary:not(.aplus-action-item--disabled):hover {
17
+ color: #5EB1FF;
18
+ }
19
+ .aplus-action-item-aplus--success {
14
20
  color: #2ed1a3;
15
21
  }
16
- .aplus-action-item--error {
22
+ .aplus-action-item-aplus--error {
17
23
  color: #FF4D4F;
18
24
  }
19
- .aplus-action-item--warn {
25
+ .aplus-action-item-aplus--warn {
20
26
  color: #FFA940;
21
27
  }
28
+ .aplus-action-item-admin--success {
29
+ color: #52C41A;
30
+ }
31
+ .aplus-action-item-admin--error {
32
+ color: #FF4D4F;
33
+ }
34
+ .aplus-action-item-admin--warn {
35
+ color: #FAAD14;
36
+ }
22
37
  .aplus-action-item--loading {
23
38
  opacity: 0.35;
24
39
  transition: opacity 0.2s;
@@ -6,12 +6,16 @@
6
6
  border-bottom: 1px solid #E9EDF3;
7
7
  margin-bottom: 0;
8
8
  }
9
- .aplus-ap-form-modal-form .ant-modal-body {
9
+ .aplus-ap-form-modal-form__content-admin {
10
10
  padding: 20px;
11
11
  }
12
12
  .aplus-ap-form-modal-form__footer {
13
13
  padding-top: 20px;
14
14
  }
15
+ .aplus-ap-form-modal-form__footer-admin {
16
+ border-top: 1px solid #E9EDF3;
17
+ padding: 12px 20px;
18
+ }
15
19
  .aplus-ap-form-modal-form .ant-modal-close {
16
20
  top: 16px;
17
21
  }
@@ -0,0 +1,11 @@
1
+ .aplus-editable-table .ant-table-cell:has(> .ant-form-item) {
2
+ padding-top: 20px !important;
3
+ padding-bottom: 0 !important;
4
+ }
5
+ .aplus-editable-table .ant-form-item {
6
+ margin-bottom: 20px;
7
+ }
8
+ .aplus-editable-table__header-cell--required {
9
+ color: #FF4D4F;
10
+ padding-right: 2px;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [