@aplus-frontend/ui 0.0.1 → 0.0.2

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 (53) hide show
  1. package/es/src/ap-field/date/index.vue.d.ts +63 -5
  2. package/es/src/ap-field/date/index.vue.mjs +115 -46
  3. package/es/src/ap-field/date-range/index.vue.d.ts +68 -6
  4. package/es/src/ap-field/date-range/index.vue.mjs +135 -62
  5. package/es/src/ap-field/interface.d.ts +3 -7
  6. package/es/src/ap-field/select/index.vue.d.ts +45 -179
  7. package/es/src/ap-field/select/index.vue.mjs +137 -66
  8. package/es/src/ap-form/items/date/index.vue.mjs +27 -29
  9. package/es/src/ap-form/items/date-range/index.vue.d.ts +1 -1
  10. package/es/src/ap-form/items/date-range/index.vue.mjs +27 -29
  11. package/es/src/ap-form/items/interface.d.ts +1 -1
  12. package/es/src/ap-form/items/select/index.vue.mjs +32 -32
  13. package/es/src/ap-table/ap-table.vue.d.ts +12 -8
  14. package/es/src/ap-table/ap-table.vue.mjs +88 -78
  15. package/es/src/ap-table/constants.d.ts +3092 -1827
  16. package/es/src/ap-table/hooks/use-table-paging.mjs +23 -23
  17. package/es/src/ap-table/interface.d.ts +5 -9
  18. package/es/src/ap-table/utils.d.ts +18 -0
  19. package/es/src/ap-table/utils.mjs +45 -17
  20. package/es/src/theme/antd-global-overwrite/admin/button.css +0 -11
  21. package/es/src/theme/antd-global-overwrite/admin/index.css +0 -11
  22. package/es/src/theme/antd-global-overwrite/aplus/button.css +0 -11
  23. package/es/src/theme/antd-global-overwrite/aplus/index.css +0 -11
  24. package/es/src/utils/index.d.ts +8 -0
  25. package/es/src/utils/index.mjs +40 -32
  26. package/es/src/work-order-modal/work-order-modal.vue.mjs +6 -8
  27. package/lib/src/ap-field/date/index.vue.d.ts +63 -5
  28. package/lib/src/ap-field/date/index.vue.js +1 -1
  29. package/lib/src/ap-field/date-range/index.vue.d.ts +68 -6
  30. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  31. package/lib/src/ap-field/interface.d.ts +3 -7
  32. package/lib/src/ap-field/select/index.vue.d.ts +45 -179
  33. package/lib/src/ap-field/select/index.vue.js +1 -1
  34. package/lib/src/ap-form/items/date/index.vue.js +1 -1
  35. package/lib/src/ap-form/items/date-range/index.vue.d.ts +1 -1
  36. package/lib/src/ap-form/items/date-range/index.vue.js +1 -1
  37. package/lib/src/ap-form/items/interface.d.ts +1 -1
  38. package/lib/src/ap-form/items/select/index.vue.js +1 -1
  39. package/lib/src/ap-table/ap-table.vue.d.ts +12 -8
  40. package/lib/src/ap-table/ap-table.vue.js +1 -1
  41. package/lib/src/ap-table/constants.d.ts +3092 -1827
  42. package/lib/src/ap-table/hooks/use-table-paging.js +1 -1
  43. package/lib/src/ap-table/interface.d.ts +5 -9
  44. package/lib/src/ap-table/utils.d.ts +18 -0
  45. package/lib/src/ap-table/utils.js +1 -1
  46. package/lib/src/theme/antd-global-overwrite/admin/button.css +0 -11
  47. package/lib/src/theme/antd-global-overwrite/admin/index.css +0 -11
  48. package/lib/src/theme/antd-global-overwrite/aplus/button.css +0 -11
  49. package/lib/src/theme/antd-global-overwrite/aplus/index.css +0 -11
  50. package/lib/src/utils/index.d.ts +8 -0
  51. package/lib/src/utils/index.js +1 -1
  52. package/lib/src/work-order-modal/work-order-modal.vue.js +1 -1
  53. package/package.json +3 -3
@@ -1,10 +1,10 @@
1
- import { defineComponent as b, ref as h, openBlock as B, createBlock as v, normalizeProps as s, guardReactiveProps as p, unref as l, withCtx as i, createVNode as y, mergeProps as g, createSlots as P, renderList as C, renderSlot as S } from "vue";
1
+ import { defineComponent as c, ref as m, computed as b, openBlock as h, createBlock as v, normalizeProps as r, guardReactiveProps as a, unref as s, withCtx as n, createVNode as B, createSlots as _, renderList as x, renderSlot as y } from "vue";
2
2
  import "../../ap-form-item.vue2.mjs";
3
3
  import "../../../ap-field/index.mjs";
4
- import { omit as f } from "lodash-unified";
5
- import _ from "../../ap-form-item.vue.mjs";
6
- import k from "../../../ap-field/select/index.vue.mjs";
7
- const z = /* @__PURE__ */ b({
4
+ import { isUndefined as g, omit as S } from "lodash-unified";
5
+ import C from "../../ap-form-item.vue.mjs";
6
+ import F from "../../../ap-field/select/index.vue.mjs";
7
+ const q = /* @__PURE__ */ c({
8
8
  name: "ApFormItemSelect",
9
9
  __name: "index",
10
10
  props: {
@@ -48,42 +48,42 @@ const z = /* @__PURE__ */ b({
48
48
  placeholder: {},
49
49
  disabled: { type: Boolean, default: !1 }
50
50
  },
51
- setup(n, { expose: u }) {
52
- const m = n, o = h();
53
- return u({
51
+ setup(p, { expose: i }) {
52
+ const o = p, t = m();
53
+ i({
54
54
  focus: () => {
55
55
  var e;
56
- (e = o.value) == null || e.focus();
56
+ (e = t.value) == null || e.focus();
57
57
  },
58
58
  blur: () => {
59
59
  var e;
60
- (e = o.value) == null || e.blur();
60
+ (e = t.value) == null || e.blur();
61
61
  }
62
- }), (e, $) => (B(), v(_, s(p(l(f)(m, ["field", "placeholder", "disabled"]))), {
63
- default: i(() => {
64
- var r, a, d;
65
- return [
66
- y(l(k), g(l(f)(e.field, ["fieldProps"]), {
67
- "field-props": {
68
- placeholder: e.placeholder,
69
- disabled: e.disabled,
70
- ...((r = e.field) == null ? void 0 : r.fieldProps) || {},
71
- bordered: e.bordered ? !1 : ((d = (a = e.field) == null ? void 0 : a.fieldProps) == null ? void 0 : d.bordered) || !1
72
- }
73
- }), P({ _: 2 }, [
74
- C(e.$slots, (w, t) => ({
75
- name: t,
76
- fn: i((c) => [
77
- S(e.$slots, t, s(p(c || {})))
78
- ])
79
- }))
80
- ]), 1040, ["field-props"])
81
- ];
82
- }),
62
+ });
63
+ const f = b(() => {
64
+ var e, l;
65
+ return {
66
+ placeholder: o.placeholder,
67
+ disabled: o.disabled,
68
+ ...o.field || {},
69
+ bordered: o.bordered ? !1 : g((e = o.field) == null ? void 0 : e.bordered) ? !0 : (l = o.field) == null ? void 0 : l.bordered
70
+ };
71
+ });
72
+ return (e, l) => (h(), v(C, r(a(s(S)(o, ["field", "placeholder", "disabled"]))), {
73
+ default: n(() => [
74
+ B(s(F), r(a(f.value)), _({ _: 2 }, [
75
+ x(e.$slots, ($, d) => ({
76
+ name: d,
77
+ fn: n((u) => [
78
+ y(e.$slots, d, r(a(u || {})))
79
+ ])
80
+ }))
81
+ ]), 1040)
82
+ ]),
83
83
  _: 3
84
84
  }, 16));
85
85
  }
86
86
  });
87
87
  export {
88
- z as default
88
+ q as default
89
89
  };
@@ -23,6 +23,11 @@ type ApTableSlots = {
23
23
  customFilterIcon?: any;
24
24
  customFilterDropdown?: any;
25
25
  };
26
+ /**
27
+ * 设置查询表单值
28
+ * @param fields
29
+ */
30
+ declare function setSearchFormValues(fields: any): void;
26
31
  declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApTableProps<any, any, "text">>, {
27
32
  bordered: boolean;
28
33
  childrenColumnName: string;
@@ -44,6 +49,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
44
49
  }>, {
45
50
  submit: () => void;
46
51
  reset: () => void;
52
+ setSearchFormValues: typeof setSearchFormValues;
47
53
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApTableProps<any, any, "text">>, {
48
54
  bordered: boolean;
49
55
  childrenColumnName: string;
@@ -134,18 +140,16 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
134
140
  };
135
141
  align: {
136
142
  type: PropType<AlignType>;
137
- default: AlignType;
143
+ default: AlignType; /**
144
+ * tips
145
+ * 通常情况下,表格渲染是不需要请求网络数据的,因此这里删掉request,
146
+ * 如果需要做映射,可以在外部发起一次网络请求,然后使用valueEnum设置匹配枚举。
147
+ */
138
148
  };
139
149
  builtinPlacements: {
140
150
  type: PropType<BuildInPlacements>;
141
151
  default: BuildInPlacements;
142
- }; /**
143
- * 获取需要在查询表单中显示的字段
144
- * 1. 在搜索表单中未隐藏
145
- * 2. 有dataIndex(映射到value)
146
- * 3. 有valueType 指定渲染的表单
147
- * 4. 没有在非表单组件名单中
148
- */
152
+ };
149
153
  children: ArrayConstructor;
150
154
  onVisibleChange: PropType<(vis: boolean) => void>;
151
155
  'onUpdate:visible': PropType<(vis: boolean) => void>;
@@ -1,17 +1,17 @@
1
- import { defineComponent as K, computed as d, createVNode as r, mergeProps as u, unref as t, openBlock as s, createElementBlock as f, normalizeClass as g, normalizeStyle as R, withCtx as c, Fragment as $, renderList as F, createBlock as H, resolveDynamicComponent as G, createCommentVNode as T, createElementVNode as B, renderSlot as P, createSlots as Q, toDisplayString as U, normalizeProps as J, guardReactiveProps as X } from "vue";
2
- import { Typography as Y, Table as Z, Tooltip as ee } from "ant-design-vue";
3
- import { ApForm as ae } from "../ap-form/index.mjs";
4
- import { apTableRenderItemMap as te, noRenderAsFormItemValueList as I, apTableFormItemMap as oe } from "./constants.mjs";
1
+ import { defineComponent as H, computed as d, createVNode as r, mergeProps as p, unref as o, watch as G, openBlock as s, createElementBlock as f, normalizeClass as b, normalizeStyle as R, withCtx as c, Fragment as Q, renderList as T, createBlock as U, resolveDynamicComponent as J, createCommentVNode as B, createElementVNode as I, renderSlot as P, createSlots as X, toDisplayString as Y, normalizeProps as Z, guardReactiveProps as ee } from "vue";
2
+ import { Typography as ae, Table as te, Tooltip as oe } from "ant-design-vue";
3
+ import { ApForm as ne } from "../ap-form/index.mjs";
4
+ import { apTableRenderItemMap as le, noRenderAsFormItemValueList as v, apTableFormItemMap as re } from "./constants.mjs";
5
5
  import "../config-provider/index.mjs";
6
- import { useTablePaging as ne } from "./hooks/use-table-paging.mjs";
7
- import { omit as v, isUndefined as le } from "lodash-unified";
6
+ import { useTablePaging as de } from "./hooks/use-table-paging.mjs";
7
+ import { omit as k, isUndefined as se } from "lodash-unified";
8
8
  import "./style/ap-table.css";
9
- import { QuestionCircleOutlined as re } from "@ant-design/icons-vue";
10
- import { useNamespace as de } from "../config-provider/hooks/use-namespace.mjs";
11
- import { useGlobalConfig as se } from "../config-provider/hooks/use-global-config.mjs";
12
- const ie = {
9
+ import { QuestionCircleOutlined as ie } from "@ant-design/icons-vue";
10
+ import { useNamespace as ue } from "../config-provider/hooks/use-namespace.mjs";
11
+ import { useGlobalConfig as pe } from "../config-provider/hooks/use-global-config.mjs";
12
+ const fe = {
13
13
  key: 0
14
- }, we = /* @__PURE__ */ K({
14
+ }, Re = /* @__PURE__ */ H({
15
15
  name: "ApTable",
16
16
  __name: "ap-table",
17
17
  props: {
@@ -120,45 +120,45 @@ const ie = {
120
120
  default: "middle"
121
121
  }
122
122
  },
123
- setup(k, {
124
- expose: z
123
+ setup(z, {
124
+ expose: E
125
125
  }) {
126
- const o = k, {
126
+ const n = z, {
127
127
  e: h,
128
128
  b: m
129
- } = de("ap-table"), E = se("uiMode"), y = d(() => {
130
- var n;
131
- let a = ((n = o.columns) == null ? void 0 : n.filter((e) => !e.hideInTable)) || [];
129
+ } = ue("ap-table"), L = pe("uiMode"), y = d(() => {
130
+ var t;
131
+ let a = ((t = n.columns) == null ? void 0 : t.filter((e) => !e.hideInTable)) || [];
132
132
  return a = a.map((e) => ({
133
133
  ...e,
134
134
  customRender({
135
135
  value: l,
136
- ...p
136
+ ...u
137
137
  }) {
138
- var x;
139
- let b;
138
+ var F;
139
+ let g;
140
140
  if (e.customRender)
141
- b = e.customRender({
141
+ g = e.customRender({
142
142
  value: l,
143
- ...p,
143
+ ...u,
144
144
  column: e
145
145
  });
146
146
  else {
147
- const q = te[e.valueType || "text"], A = ((x = e.fieldProps) == null ? void 0 : x.field) || e.fieldProps || {}, M = e.valueType === "switch", V = e.valueType === "index", _ = M ? {
147
+ const A = le[e.valueType || "text"], M = ((F = e.fieldProps) == null ? void 0 : F.field) || e.fieldProps || {}, _ = e.valueType === "switch", K = e.valueType === "index", $ = _ ? {
148
148
  checked: l
149
149
  } : {
150
- value: V ? p.index + 1 : l
150
+ value: K ? u.index + 1 : l
151
151
  };
152
- b = r(q, u(v(A, ["request"]), _, {
152
+ g = r(A, p(k(M, ["request"]), $, {
153
153
  mode: "read"
154
154
  }), null);
155
155
  }
156
- return W(e, l, b);
156
+ return W(e, l, g);
157
157
  }
158
158
  })), a;
159
159
  }), C = d(() => {
160
- var a, n;
161
- return ((n = (a = o.columns) == null ? void 0 : a.filter((e) => !e.hideInSearch && e.dataIndex && e.valueType && !I.includes(e.valueType))) == null ? void 0 : n.map((e) => ({
160
+ var a, t;
161
+ return ((t = (a = n.columns) == null ? void 0 : a.filter((e) => !e.hideInSearch && e.dataIndex && (e.valueType || e.customRenderFormItem) && !v.includes(e.valueType))) == null ? void 0 : t.map((e) => ({
162
162
  ...e,
163
163
  fieldProps: {
164
164
  ...e.fieldProps || {},
@@ -166,102 +166,112 @@ const ie = {
166
166
  name: e.dataIndex
167
167
  }
168
168
  }))) || [];
169
- }), N = d(() => t(y).filter((a) => a.sorter === !0).map((a) => a.dataIndex)), D = d(() => t(y).filter((a) => a.filters && !a.onFilter).map((a) => a.dataIndex)), {
170
- formRef: L,
171
- submit: S,
172
- reset: w,
169
+ }), N = d(() => o(y).filter((a) => a.sorter === !0).map((a) => a.dataIndex)), D = d(() => o(y).filter((a) => a.filters && !a.onFilter).map((a) => a.dataIndex)), {
170
+ formRef: S,
171
+ submit: w,
172
+ reset: x,
173
173
  tableProps: i,
174
- handleTableChange: O
175
- } = ne({
174
+ handleTableChange: O,
175
+ data: V
176
+ } = de({
176
177
  async request(a) {
177
178
  var e, l;
178
- const n = await ((e = o.request) == null ? void 0 : e.call(o, a));
179
- return (l = o.onLoad) == null || l.call(o, (n == null ? void 0 : n.data) || []), {
180
- data: (n == null ? void 0 : n.data) || [],
181
- total: (n == null ? void 0 : n.total) || 0
179
+ const t = await ((e = n.request) == null ? void 0 : e.call(n, a));
180
+ return (l = n.onLoad) == null || l.call(n, (t == null ? void 0 : t.data) || []), {
181
+ data: (t == null ? void 0 : t.data) || [],
182
+ total: (t == null ? void 0 : t.total) || 0
182
183
  };
183
184
  },
184
- filterFields: t(D),
185
- sortFields: t(N),
186
- defaultParams: o.params,
187
- defaultData: o.defaultData,
188
- manual: o.manual,
189
- defaultCurrent: o.pagination ? o.pagination.defaultCurrent : void 0,
190
- defaultPageSize: o.pagination ? o.pagination.defaultPageSize : void 0,
191
- formatParams: o.beforeSearchSubmit
185
+ filterFields: o(D),
186
+ sortFields: o(N),
187
+ defaultParams: n.params,
188
+ defaultData: n.defaultData,
189
+ manual: n.manual,
190
+ defaultCurrent: n.pagination ? n.pagination.defaultCurrent : void 0,
191
+ defaultPageSize: n.pagination ? n.pagination.defaultPageSize : void 0,
192
+ formatParams: n.beforeSearchSubmit
192
193
  }), j = d(() => ({
193
- ...o,
194
- ...t(i),
195
- loading: le(o.loading) ? t(i).loading : o.loading,
196
- pagination: o.pagination === !1 ? !1 : t(i).pagination
194
+ ...n,
195
+ ...o(i),
196
+ loading: se(n.loading) ? o(i).loading : n.loading,
197
+ pagination: n.pagination === !1 ? !1 : o(i).pagination
197
198
  }));
198
- function W(a, n, e) {
199
- return I.includes(a.valueType) ? e : a.copyable || a.ellipsis ? r(Y.Text, {
199
+ function W(a, t, e) {
200
+ return v.includes(a.valueType) ? e : a.copyable || a.ellipsis ? r(ae.Text, {
200
201
  copyable: a.copyable ? {
201
- text: n,
202
+ text: t,
202
203
  tooltip: !1
203
204
  } : !1,
204
205
  ellipsis: a.ellipsis ? {
205
- tooltip: n
206
+ tooltip: t
206
207
  } : !1,
207
208
  content: e
208
209
  }, null) : e;
209
210
  }
210
- return z({
211
- submit: () => S(),
212
- reset: () => w()
213
- }), (a, n) => (s(), f("div", {
214
- class: g(a.card ? null : t(m)("wrapper"))
211
+ G(() => o(V).loading, (a) => {
212
+ var t;
213
+ (t = n.onLoadingChange) == null || t.call(n, a);
214
+ });
215
+ function q(a) {
216
+ var t, e, l;
217
+ (l = (e = (t = S.value) == null ? void 0 : t.apForm) == null ? void 0 : e.setFieldsValue) == null || l.call(e, a);
218
+ }
219
+ return E({
220
+ submit: () => w(),
221
+ reset: () => x(),
222
+ setSearchFormValues: q
223
+ }), (a, t) => (s(), f("div", {
224
+ class: b(a.card ? null : o(m)("wrapper"))
215
225
  }, [a.searchForm !== !1 && C.value.length > 0 ? (s(), f("div", {
216
226
  key: 0,
217
- class: g(a.card ? t(h)("search-wrapper") : null),
227
+ class: b(a.card ? o(h)("search-wrapper") : null),
218
228
  style: R(a.searchFormWrapperStyle)
219
- }, [r(t(ae).SearchForm, u(a.searchForm || {}, {
229
+ }, [r(o(ne).SearchForm, p(a.searchForm || {}, {
220
230
  ref_key: "formRef",
221
- ref: L,
231
+ ref: S,
222
232
  "custom-reset": "",
223
- onSubmit: t(S),
224
- onReset: t(w),
225
- "submit-loading": t(i).loading
233
+ onSubmit: o(w),
234
+ onReset: o(x),
235
+ "submit-loading": o(i).loading
226
236
  }), {
227
- default: c(() => [(s(!0), f($, null, F(C.value, (e) => (s(), H(G(e.customRenderFormItem ? e.customRenderFormItem(e) : t(oe)[e.valueType || "text"]), u({
237
+ default: c(() => [(s(!0), f(Q, null, T(C.value, (e) => (s(), U(J(e.customRenderFormItem ? e.customRenderFormItem(e) : o(re)[e.valueType || "text"]), p({
228
238
  key: e.dataIndex,
229
239
  ref_for: !0
230
240
  }, e.fieldProps || {}, {
231
241
  span: e.span
232
242
  }), null, 16, ["span"]))), 128))]),
233
243
  _: 1
234
- }, 16, ["onSubmit", "onReset", "submit-loading"])], 6)) : T("", !0), B("div", {
235
- class: g(a.card ? t(h)("table-wrapper") : null),
244
+ }, 16, ["onSubmit", "onReset", "submit-loading"])], 6)) : B("", !0), I("div", {
245
+ class: b(a.card ? o(h)("table-wrapper") : null),
236
246
  style: R(a.tableWrapperStyle)
237
- }, [P(a.$slots, "title"), r(t(Z), u({
238
- class: t(E) === "admin" ? t(m)("table-admin") : t(m)("table")
247
+ }, [P(a.$slots, "title"), r(o(te), p({
248
+ class: o(L) === "admin" ? o(m)("table-admin") : o(m)("table")
239
249
  }, j.value, {
240
- onChange: t(O),
250
+ onChange: o(O),
241
251
  columns: y.value
242
- }), Q({
252
+ }), X({
243
253
  headerCell: c(({
244
254
  column: e,
245
255
  title: l
246
- }) => [e.tooltip ? (s(), f("span", ie, [B("span", null, U(l), 1), r(t(ee), {
256
+ }) => [e.tooltip ? (s(), f("span", fe, [I("span", null, Y(l), 1), r(o(oe), {
247
257
  title: e.tooltip,
248
258
  placement: "bottom"
249
259
  }, {
250
- default: c(() => [r(t(re), {
260
+ default: c(() => [r(o(ie), {
251
261
  style: {
252
262
  color: "#0070ff",
253
263
  "padding-left": "4px"
254
264
  }
255
265
  })]),
256
266
  _: 2
257
- }, 1032, ["title"])])) : T("", !0)]),
267
+ }, 1032, ["title"])])) : B("", !0)]),
258
268
  _: 2
259
- }, [F(t(v)(a.$slots, "title"), (e, l) => ({
269
+ }, [T(o(k)(a.$slots, "title"), (e, l) => ({
260
270
  name: l,
261
- fn: c((p) => [P(a.$slots, l, J(X(p || {})))])
271
+ fn: c((u) => [P(a.$slots, l, Z(ee(u || {})))])
262
272
  }))]), 1040, ["class", "onChange", "columns"])], 6)], 2));
263
273
  }
264
274
  });
265
275
  export {
266
- we as default
276
+ Re as default
267
277
  };