@aplus-frontend/ui 0.1.35 → 0.1.37

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 (75) hide show
  1. package/es/index.mjs +136 -133
  2. package/es/src/ap-button/ap-action-button.vue.d.ts +5 -0
  3. package/es/src/ap-button/ap-action-button.vue.mjs +8 -8
  4. package/es/src/ap-form/ap-form.vue2.mjs +93 -93
  5. package/es/src/ap-form/index.d.ts +3 -1
  6. package/es/src/ap-form/index.mjs +5 -1
  7. package/es/src/ap-form/interface.d.ts +4 -0
  8. package/es/src/ap-form/set/index.vue.d.ts +43 -0
  9. package/es/src/ap-form/set/index.vue.mjs +35 -0
  10. package/es/src/ap-form/set/index.vue2.mjs +4 -0
  11. package/es/src/ap-table/ap-table.vue.d.ts +1 -0
  12. package/es/src/ap-table/ap-table.vue.mjs +109 -107
  13. package/es/src/ap-table/components/setting/utils.d.ts +1 -1
  14. package/es/src/ap-table/components/setting/utils.mjs +12 -21
  15. package/es/src/ap-table/components/style/setting/modal.css +15 -3
  16. package/es/src/ap-table/interface.d.ts +5 -0
  17. package/es/src/ap-table/utils.mjs +14 -13
  18. package/es/src/ap-upload/apUpload.vue.mjs +40 -39
  19. package/es/src/business/ap-button-group/ApButtonGroup.vue.d.ts +21 -0
  20. package/es/src/business/ap-button-group/ApButtonGroup.vue.mjs +4 -0
  21. package/es/src/business/ap-button-group/ApButtonGroup.vue2.mjs +71 -0
  22. package/es/src/business/ap-button-group/interface.d.ts +29 -0
  23. package/es/src/business/ap-button-group/interface.mjs +1 -0
  24. package/es/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +1 -1
  25. package/es/src/business/ap-table-modal/hooks/use-create-table-modal.mjs +11 -11
  26. package/es/src/business/hooks/usePageListApTable.d.ts +1 -0
  27. package/es/src/business/index.d.ts +607 -4
  28. package/es/src/business/index.mjs +27 -23
  29. package/es/src/editable-table/form-item.vue.mjs +76 -97
  30. package/es/src/editable-table/hooks/use-get-columns.mjs +41 -35
  31. package/es/src/editable-table/index.vue.mjs +79 -100
  32. package/es/src/editable-table/style/index.css +12 -0
  33. package/es/src/editable-table/utils.d.ts +8 -1
  34. package/es/src/editable-table/utils.mjs +103 -69
  35. package/es/src/index.mjs +220 -217
  36. package/es/src/theme/ap-table/setting/modal.css +15 -3
  37. package/es/src/theme/editable-table/index.css +12 -0
  38. package/lib/index.js +1 -1
  39. package/lib/src/ap-button/ap-action-button.vue.d.ts +5 -0
  40. package/lib/src/ap-button/ap-action-button.vue.js +1 -1
  41. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  42. package/lib/src/ap-form/index.d.ts +3 -1
  43. package/lib/src/ap-form/index.js +1 -1
  44. package/lib/src/ap-form/interface.d.ts +4 -0
  45. package/lib/src/ap-form/set/index.vue.d.ts +43 -0
  46. package/lib/src/ap-form/set/index.vue.js +1 -0
  47. package/lib/src/ap-form/set/index.vue2.js +1 -0
  48. package/lib/src/ap-table/ap-table.vue.d.ts +1 -0
  49. package/lib/src/ap-table/ap-table.vue.js +1 -1
  50. package/lib/src/ap-table/components/setting/utils.d.ts +1 -1
  51. package/lib/src/ap-table/components/setting/utils.js +1 -1
  52. package/lib/src/ap-table/components/style/setting/modal.css +15 -3
  53. package/lib/src/ap-table/interface.d.ts +5 -0
  54. package/lib/src/ap-table/utils.js +1 -1
  55. package/lib/src/ap-upload/apUpload.vue.js +1 -1
  56. package/lib/src/business/ap-button-group/ApButtonGroup.vue.d.ts +21 -0
  57. package/lib/src/business/ap-button-group/ApButtonGroup.vue.js +1 -0
  58. package/lib/src/business/ap-button-group/ApButtonGroup.vue2.js +1 -0
  59. package/lib/src/business/ap-button-group/interface.d.ts +29 -0
  60. package/lib/src/business/ap-button-group/interface.js +1 -0
  61. package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.d.ts +1 -1
  62. package/lib/src/business/ap-table-modal/hooks/use-create-table-modal.js +1 -1
  63. package/lib/src/business/hooks/usePageListApTable.d.ts +1 -0
  64. package/lib/src/business/index.d.ts +607 -4
  65. package/lib/src/business/index.js +1 -1
  66. package/lib/src/editable-table/form-item.vue.js +1 -1
  67. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  68. package/lib/src/editable-table/index.vue.js +1 -1
  69. package/lib/src/editable-table/style/index.css +12 -0
  70. package/lib/src/editable-table/utils.d.ts +8 -1
  71. package/lib/src/editable-table/utils.js +1 -1
  72. package/lib/src/index.js +1 -1
  73. package/lib/src/theme/ap-table/setting/modal.css +15 -3
  74. package/lib/src/theme/editable-table/index.css +12 -0
  75. package/package.json +5 -5
@@ -1,9 +1,9 @@
1
- import { defineComponent as D, ref as L, reactive as k, nextTick as K, toRaw as T, computed as $, openBlock as G, createBlock as H, unref as b, mergeProps as J, withCtx as Q, renderSlot as U } from "vue";
1
+ import { defineComponent as D, ref as L, reactive as k, nextTick as K, toRaw as b, computed as $, openBlock as G, createBlock as H, unref as B, mergeProps as J, withCtx as Q, renderSlot as U } from "vue";
2
2
  import { Form as X } from "ant-design-vue";
3
3
  import { useProvideForm as Y } from "./context.mjs";
4
- import { isArray as d, cloneDeep as B, isFunction as V, isPlainObject as C, omit as Z } from "lodash-unified";
4
+ import { isArray as f, cloneDeep as I, isFunction as m, isPlainObject as _, omit as Z } from "lodash-unified";
5
5
  import { INTERNAL_FORM_INSTANCE_MARK as ee } from "./constant.mjs";
6
- import { isDef as _ } from "../utils/index.mjs";
6
+ import { isDef as y } from "../utils/index.mjs";
7
7
  import te from "./utils/set.mjs";
8
8
  const ue = /* @__PURE__ */ D({
9
9
  __name: "ap-form",
@@ -33,153 +33,153 @@ const ue = /* @__PURE__ */ D({
33
33
  onValidate: {},
34
34
  initialValues: {}
35
35
  },
36
- setup(I, { expose: M }) {
37
- const a = I;
38
- function p(e, t, l = !0) {
39
- var r;
40
- if (d(e)) {
41
- let i = s;
36
+ setup(M, { expose: O }) {
37
+ const a = M;
38
+ function g(e, t, l = !0) {
39
+ var s;
40
+ if (f(e)) {
41
+ let o = r;
42
42
  for (let u = 0; u < e.length - 1; u++)
43
- e[u] in i || (i[e[u]] = {}), i = i[e[u]];
44
- i[e[e.length - 1]] = t;
43
+ e[u] in o || (o[e[u]] = {}), o = o[e[u]];
44
+ o[e[e.length - 1]] = t;
45
45
  } else
46
- s[e] = t;
47
- let o = d(e) ? e[0] : e;
48
- l && ((r = a.onValuesChange) == null || r.call(a, { [o]: s[o] }, s)), F();
46
+ r[e] = t;
47
+ let i = f(e) ? e[0] : e;
48
+ l && ((s = a.onValuesChange) == null || s.call(a, { [i]: r[i] }, r)), h();
49
49
  }
50
- function O(e) {
50
+ function w(e) {
51
51
  var l;
52
- const t = g(e, c);
52
+ const t = p(e, c);
53
53
  (l = a.onFinish) == null || l.call(a, t);
54
54
  }
55
55
  const n = L();
56
- let m = a.initialValues ? B(a.initialValues) : {}, c = {};
57
- const s = k(a.initialValues || {});
58
- let h = [];
59
- const w = async () => {
56
+ let v = a.initialValues ? I(a.initialValues) : {}, c = {};
57
+ const r = k(a.initialValues || {});
58
+ let F = [];
59
+ const E = async () => {
60
60
  var e;
61
61
  (e = n.value) == null || e.resetFields(), await K(() => {
62
- Object.keys(s).forEach((t) => delete s[t]), Object.assign(s, B(m)), F();
62
+ Object.keys(r).forEach((t) => delete r[t]), Object.assign(r, I(v)), h();
63
63
  });
64
- }, E = (e) => {
64
+ }, j = (e) => {
65
65
  var t;
66
66
  (t = n.value) == null || t.clearValidate(e);
67
- }, j = (e, t) => {
67
+ }, x = (e, t) => {
68
68
  var l;
69
69
  return (l = n.value) == null ? void 0 : l.validateFields(e, t);
70
- }, x = async (e, t) => {
71
- var o;
72
- const l = await ((o = n.value) == null ? void 0 : o.validateFields(
70
+ }, A = async (e, t) => {
71
+ var i;
72
+ const l = await ((i = n.value) == null ? void 0 : i.validateFields(
73
73
  e,
74
74
  t
75
75
  ));
76
- return g(l, c);
77
- }, A = (e) => {
76
+ return p(l, c);
77
+ }, N = (e) => {
78
78
  var t;
79
79
  return (t = n.value) == null ? void 0 : t.getFieldsValue(e);
80
- }, N = (e) => {
80
+ }, P = (e) => {
81
81
  var l;
82
82
  const t = (l = n.value) == null ? void 0 : l.getFieldsValue(e);
83
- return g(t, c);
84
- }, P = (e, t) => {
83
+ return p(t, c);
84
+ }, S = (e, t) => {
85
85
  var l;
86
86
  return (l = n.value) == null ? void 0 : l.validate(e, t);
87
- }, S = (e, t = {}) => {
87
+ }, W = (e, t = {}) => {
88
88
  var l;
89
89
  (l = n.value) == null || l.scrollToField(e, t);
90
- }, W = (e) => {
91
- Object.assign(s, e), F();
92
- }, y = (e, t) => {
93
- p(e, t), F();
90
+ }, q = (e) => {
91
+ Object.assign(r, e), h();
92
+ }, R = (e, t) => {
93
+ g(e, t), h();
94
94
  };
95
- function v(e, t) {
96
- return t || e(T(s)), h.push(e), () => {
97
- h = h.filter((l) => l !== e);
95
+ function V(e, t) {
96
+ return t || e(b(r)), F.push(e), () => {
97
+ F = F.filter((l) => l !== e);
98
98
  };
99
99
  }
100
- function R({ initialValue: e, name: t, transform: l }) {
101
- if (_(e) && _(t))
102
- if (p(t, e, !1), d(t)) {
103
- let o = m;
104
- for (let r = 0; r < t.length - 1; r++)
105
- _(o[t[r]]) || (o[t[r]] = {}), o = o[t[r]];
106
- o[t[t.length - 1]] = e;
100
+ function T({ initialValue: e, name: t, transform: l }) {
101
+ if (y(e) && y(t))
102
+ if (g(t, e, !1), f(t)) {
103
+ let i = v;
104
+ for (let s = 0; s < t.length - 1; s++)
105
+ y(i[t[s]]) || (i[t[s]] = {}), i = i[t[s]];
106
+ i[t[t.length - 1]] = e;
107
107
  } else
108
- m[t] = e;
109
- c = te(
108
+ v[t] = e;
109
+ l && (c = te(
110
110
  c,
111
111
  [t].flat(1),
112
112
  l,
113
113
  !0
114
- );
114
+ ));
115
115
  }
116
- function q(e) {
116
+ function z(e) {
117
117
  if (e !== ee) {
118
118
  console.warn("getInternalInstance should only used at internal");
119
119
  return;
120
120
  }
121
121
  return {
122
- registerField: R,
123
- registerWatch: v
122
+ registerField: T,
123
+ registerWatch: V
124
124
  };
125
125
  }
126
- function F() {
127
- if (h.length) {
128
- const e = T(s);
129
- h.forEach((t) => {
126
+ function h() {
127
+ if (F.length) {
128
+ const e = b(r);
129
+ F.forEach((t) => {
130
130
  t(e);
131
131
  });
132
132
  }
133
133
  }
134
- function g(e, t) {
134
+ function p(e, t) {
135
135
  if (e == null)
136
136
  return;
137
- let l = d(e) ? [] : {};
138
- return Object.keys(e).forEach((o) => {
139
- const r = e[o], i = t[o], u = V(i) ? i : i == null ? void 0 : i.transformer, z = V(i) ? !0 : i == null ? void 0 : i.flat;
140
- if (V(u)) {
141
- const f = u(r);
142
- z ? d(f) && d(l) ? l = [...l, ...f] : C(f) && C(l) ? l = {
137
+ let l = f(e) ? [] : {};
138
+ return Object.keys(e).forEach((i) => {
139
+ const s = e[i], o = t == null ? void 0 : t[i], u = m(o) ? o : o == null ? void 0 : o.transformer, C = m(o) ? !0 : o == null ? void 0 : o.flat;
140
+ if (m(u)) {
141
+ const d = u(s);
142
+ C ? f(d) && f(l) ? l = [...l, ...d] : _(d) && _(l) ? l = {
143
143
  ...l,
144
- ...f
145
- } : l[o] = f : l[o] = f;
146
- } else if (C(r) || d(r)) {
147
- const f = g(
148
- r,
149
- i
144
+ ...d
145
+ } : l[i] = d : l[i] = d;
146
+ } else if (_(s) || f(s)) {
147
+ const d = p(
148
+ s,
149
+ o
150
150
  );
151
- l[o] = f;
151
+ l[i] = d;
152
152
  } else
153
- l[o] = r;
153
+ l[i] = s;
154
154
  }), l;
155
155
  }
156
156
  return Y({
157
- model: $(() => s),
158
- updateModel: p,
157
+ model: $(() => r),
158
+ updateModel: g,
159
159
  internalInstance: {
160
- registerWatch: v,
161
- registerField: R,
162
- setFieldValue: y
160
+ registerWatch: V,
161
+ registerField: T,
162
+ setFieldValue: R
163
163
  }
164
- }), M({
165
- resetFields: w,
166
- clearValidate: E,
167
- validateFields: j,
168
- getFieldsValue: A,
169
- validate: P,
170
- scrollToField: S,
171
- setFieldsValue: W,
172
- setFieldValue: y,
173
- registerWatch: v,
174
- validateFieldsReturnTransformed: x,
175
- getFieldsValueTransformed: N,
176
- getInternalInstance: q
177
- }), (e, t) => (G(), H(b(X), J({
164
+ }), O({
165
+ resetFields: E,
166
+ clearValidate: j,
167
+ validateFields: x,
168
+ getFieldsValue: N,
169
+ validate: S,
170
+ scrollToField: W,
171
+ setFieldsValue: q,
172
+ setFieldValue: R,
173
+ registerWatch: V,
174
+ validateFieldsReturnTransformed: A,
175
+ getFieldsValueTransformed: P,
176
+ getInternalInstance: z
177
+ }), (e, t) => (G(), H(B(X), J({
178
178
  ref_key: "formRef",
179
179
  ref: n
180
- }, b(Z)(a, ["initialValues", "onValuesChange", "onFinish"]), {
181
- onFinish: O,
182
- model: s
180
+ }, B(Z)(a, ["initialValues", "onValuesChange", "onFinish"]), {
181
+ onFinish: w,
182
+ model: r
183
183
  }), {
184
184
  default: Q(() => [
185
185
  U(e.$slots, "default")
@@ -6,6 +6,7 @@ import { default as ApFormSearchForm } from './search-form/index.vue';
6
6
  import { default as ApFormModalForm } from './modal-form/index.vue';
7
7
  import { default as useWatch } from './hooks/use-watch';
8
8
  import { default as ApFormDependency } from './dependency/index.vue';
9
+ import { default as ApFormSet } from './set/index.vue';
9
10
  type ApFormMixedProps = typeof _ApForm & {
10
11
  FormItem: typeof ApFormItem;
11
12
  FormItemGroup: typeof ApFormItemGroup;
@@ -14,8 +15,9 @@ type ApFormMixedProps = typeof _ApForm & {
14
15
  ModalForm: typeof ApFormModalForm;
15
16
  useWatch: typeof useWatch;
16
17
  Dependency: typeof ApFormDependency;
18
+ Set: typeof ApFormSet;
17
19
  };
18
20
  declare const ApForm: ApFormMixedProps;
19
21
  export * from './items';
20
22
  export * from './interface';
21
- export { ApForm, ApFormItem, ApFormItemGroup, ApFormList, ApFormSearchForm, ApFormModalForm, ApFormDependency };
23
+ export { ApForm, ApFormItem, ApFormItemGroup, ApFormList, ApFormSearchForm, ApFormModalForm, ApFormDependency, ApFormSet };
@@ -6,6 +6,7 @@ import "./search-form/index.vue2.mjs";
6
6
  import "./modal-form/index.vue2.mjs";
7
7
  import o from "./hooks/use-watch.mjs";
8
8
  import "./dependency/index.vue2.mjs";
9
+ import "./set/index.vue2.mjs";
9
10
  import "./items/index.mjs";
10
11
  import "./interface.mjs";
11
12
  import r from "./ap-form.vue2.mjs";
@@ -15,6 +16,7 @@ import i from "./ap-form-list.vue.mjs";
15
16
  import a from "./search-form/index.vue.mjs";
16
17
  import s from "./modal-form/index.vue.mjs";
17
18
  import e from "./dependency/index.vue.mjs";
19
+ import f from "./set/index.vue.mjs";
18
20
  const m = r;
19
21
  m.FormItem = p;
20
22
  m.FormItemGroup = t;
@@ -23,6 +25,7 @@ m.SearchForm = a;
23
25
  m.ModalForm = s;
24
26
  m.useWatch = o;
25
27
  m.Dependency = e;
28
+ m.Set = f;
26
29
  export {
27
30
  m as ApForm,
28
31
  e as ApFormDependency,
@@ -30,5 +33,6 @@ export {
30
33
  t as ApFormItemGroup,
31
34
  i as ApFormList,
32
35
  s as ApFormModalForm,
33
- a as ApFormSearchForm
36
+ a as ApFormSearchForm,
37
+ f as ApFormSet
34
38
  };
@@ -172,6 +172,10 @@ export type ApFormSetProps = {
172
172
  * 聚合成(数组/对象)
173
173
  */
174
174
  as?: 'array' | 'object';
175
+ /**
176
+ * 默认值
177
+ */
178
+ initialValue?: any;
175
179
  /**
176
180
  * 转换函数(表单提交时触发)
177
181
  * @param value
@@ -0,0 +1,43 @@
1
+ import { ApFormSetProps } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
3
+ declare function __VLS_template(): {
4
+ slots: Readonly<{
5
+ default: any;
6
+ }> & {
7
+ default: any;
8
+ };
9
+ refs: {};
10
+ attrs: Partial<{}>;
11
+ };
12
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
13
+ declare const __VLS_component: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<ApFormSetProps>, {
14
+ as: string;
15
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ApFormSetProps>, {
16
+ as: string;
17
+ }>>>, {
18
+ as: "array" | "object";
19
+ }, {}>;
20
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
21
+ export default _default;
22
+ type __VLS_WithDefaults<P, D> = {
23
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
24
+ default: D[K];
25
+ }> : P[K];
26
+ };
27
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
+ type __VLS_TypePropsToOption<T> = {
29
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
30
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
31
+ } : {
32
+ type: PropType<T[K]>;
33
+ required: true;
34
+ };
35
+ };
36
+ type __VLS_WithTemplateSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
41
+ type __VLS_PrettifyLocal<T> = {
42
+ [K in keyof T]: T[K];
43
+ } & {};
@@ -0,0 +1,35 @@
1
+ import { defineComponent as c, useSlots as u, ref as f, watchEffect as p, cloneVNode as d, onMounted as V, openBlock as m, createElementBlock as _, Fragment as y, renderList as k, createBlock as F, resolveDynamicComponent as h } from "vue";
2
+ import { useInjectForm as v } from "../context.mjs";
3
+ import { isFunction as w, cloneDeep as x } from "lodash-unified";
4
+ import { isPromise as B } from "@fruits-chain/utils";
5
+ const j = /* @__PURE__ */ c({
6
+ __name: "index",
7
+ props: {
8
+ name: {},
9
+ as: { default: "array" },
10
+ initialValue: {},
11
+ transform: {}
12
+ },
13
+ setup(s) {
14
+ const { internalInstance: t } = v(), a = u(), e = s, l = f([]);
15
+ return p(() => {
16
+ if (a != null && a.default) {
17
+ const n = a.default();
18
+ l.value = n.map((r, o) => {
19
+ const i = e.as === "array" ? [e.name, o] : [e.name, r.props.name];
20
+ return d(r, { name: i });
21
+ });
22
+ }
23
+ }), V(async () => {
24
+ let n = w(e.initialValue) ? e.initialValue() : e.initialValue;
25
+ B(n) && (n = await n), t == null || t.registerField({
26
+ name: e.name,
27
+ initialValue: x(n),
28
+ transform: e.transform
29
+ });
30
+ }), (n, r) => (m(!0), _(y, null, k(l.value, (o, i) => (m(), F(h(o), { key: i }))), 128));
31
+ }
32
+ });
33
+ export {
34
+ j as default
35
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -7,6 +7,7 @@ declare const _default: <RecordType>(__VLS_props: NonNullable<Awaited<typeof __V
7
7
  expose(exposed: ShallowUnwrapRef<{
8
8
  submit: () => void;
9
9
  reset: () => void;
10
+ refresh: () => void;
10
11
  setSearchFormValues: (fields: any) => void;
11
12
  getSearchFormValues: () => Partial<any> | undefined;
12
13
  getShownColumns: () => ColumnsType<RecordType>;