@aplus-frontend/ui 0.1.42 → 0.1.44

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.
@@ -1,25 +1,25 @@
1
- import { computed as r } from "vue";
1
+ import { computed as o } from "vue";
2
2
  import "../../config-provider/index.mjs";
3
- import { isDef as c } from "../../utils/index.mjs";
4
- import { useLocale as n } from "../../config-provider/hooks/use-locale.mjs";
5
- const s = ["Select", "Date"], i = [
3
+ import { isDef as n } from "../../utils/index.mjs";
4
+ import { useLocale as i } from "../../config-provider/hooks/use-locale.mjs";
5
+ const c = ["Select", "Date"], a = [
6
6
  "Text",
7
7
  "TextArea",
8
8
  "Number",
9
9
  "TextPassword"
10
- ], p = (o, t) => {
11
- const { t: e } = n();
12
- return r(() => {
13
- if (c(t.placeholder))
14
- return t.placeholder;
15
- if (o === "DateRange")
16
- return [e("ap.common.chooseText"), e("ap.common.chooseText")];
17
- if (s.includes(o))
10
+ ], d = (t, r) => {
11
+ const { t: e } = i();
12
+ return o(() => {
13
+ if (n(r.placeholder))
14
+ return r.placeholder;
15
+ if (t === "DateRange")
16
+ return [e("ap.field.startDateText"), e("ap.field.endDateText")];
17
+ if (c.includes(t))
18
18
  return e("ap.common.chooseText");
19
- if (i.includes(o))
19
+ if (a.includes(t))
20
20
  return e("ap.common.inputText");
21
21
  });
22
22
  };
23
23
  export {
24
- p as useDefaultPlaceholder
24
+ d as useDefaultPlaceholder
25
25
  };
@@ -1,25 +1,24 @@
1
- import { defineComponent as Ce, useSlots as Te, ref as P, computed as s, unref as t, createVNode as f, Fragment as U, watchEffect as Fe, watch as G, openBlock as m, createElementBlock as T, normalizeClass as c, normalizeStyle as M, mergeProps as h, createSlots as J, withCtx as w, renderList as Q, createBlock as X, resolveDynamicComponent as xe, renderSlot as S, createCommentVNode as Y, createElementVNode as I, h as Be, normalizeProps as ke, guardReactiveProps as ze } from "vue";
2
- import { Typography as Pe, Divider as Ie, Button as Ne, Table as Le } from "ant-design-vue";
1
+ import { defineComponent as Ce, useSlots as ve, ref as z, computed as s, unref as t, createVNode as f, Fragment as U, watchEffect as Te, watch as G, openBlock as m, createElementBlock as T, normalizeClass as c, normalizeStyle as M, mergeProps as h, createSlots as J, withCtx as w, renderList as Q, createBlock as X, resolveDynamicComponent as Fe, renderSlot as S, createCommentVNode as Y, createElementVNode as I, h as xe, normalizeProps as Be, guardReactiveProps as Pe } from "vue";
2
+ import { Typography as ke, Divider as ze, Button as Ie, Table as Ne } from "ant-design-vue";
3
3
  import { useToken as Ee } from "ant-design-vue/es/theme/internal";
4
4
  import { ApForm as Ke } from "../ap-form/index.mjs";
5
5
  import { noRenderAsFormItemValueList as Z } from "./constants.mjs";
6
6
  import "../config-provider/index.mjs";
7
- import { useTablePaging as Oe } from "./hooks/use-table-paging.mjs";
8
- import { omit as _, isUndefined as g, isBoolean as Ve } from "lodash-unified";
7
+ import { useTablePaging as Le } from "./hooks/use-table-paging.mjs";
8
+ import { omit as _, isUndefined as g, isBoolean as Oe } from "lodash-unified";
9
9
  import "./style/ap-table.css";
10
- import { apColumnToColumn as De, getTableTitle as je, getTableRenderType as Ae, getTableRenderProps as We, getTableCellRenderNode as $e, getColumnOrder as ee, updateFormProps as He, getFieldProps as qe, getPlaceholder as Ue, getSearchFormItemRenderNode as Ge, objectToString as Me } from "./utils.mjs";
11
- import Je from "./hooks/use-table-content-height.mjs";
12
- import { getRawDisplayValue as Qe } from "../editable-table/utils.mjs";
13
- import Xe from "./hooks/use-table-row-selection.mjs";
14
- import { isDef as Ye } from "../utils/index.mjs";
15
- import { SettingOutlined as Ze } from "@ant-design/icons-vue";
10
+ import { apColumnToColumn as Ve, getTableTitle as De, getTableRenderType as je, getTableRenderProps as Ae, getTableCellRenderNode as We, getColumnOrder as ee, updateFormProps as $e, getFieldProps as He, getSearchFormItemRenderNode as qe, objectToString as Ue } from "./utils.mjs";
11
+ import Ge from "./hooks/use-table-content-height.mjs";
12
+ import { getRawDisplayValue as Me } from "../editable-table/utils.mjs";
13
+ import Je from "./hooks/use-table-row-selection.mjs";
14
+ import { isDef as Qe } from "../utils/index.mjs";
15
+ import { SettingOutlined as Xe } from "@ant-design/icons-vue";
16
16
  import "./components/setting/modal/index.vue.mjs";
17
- import { useProvideApTable as _e } from "./context.mjs";
18
- import { useLocale as ea } from "../config-provider/hooks/use-locale.mjs";
19
- import { useNamespace as aa } from "../config-provider/hooks/use-namespace.mjs";
20
- import { useGlobalConfig as oa } from "../config-provider/hooks/use-global-config.mjs";
21
- import ta from "./components/setting/modal/index.vue2.mjs";
22
- const Fa = /* @__PURE__ */ Ce({
17
+ import { useProvideApTable as Ye } from "./context.mjs";
18
+ import { useNamespace as Ze } from "../config-provider/hooks/use-namespace.mjs";
19
+ import { useGlobalConfig as _e } from "../config-provider/hooks/use-global-config.mjs";
20
+ import ea from "./components/setting/modal/index.vue2.mjs";
21
+ const Ra = /* @__PURE__ */ Ce({
23
22
  name: "ApTable",
24
23
  __name: "ap-table",
25
24
  props: {
@@ -148,112 +147,108 @@ const Fa = /* @__PURE__ */ Ce({
148
147
  }) {
149
148
  const a = ae;
150
149
  let N = 0;
151
- const b = Te(), [, te] = Ee(), {
152
- t: re
153
- } = ea(), {
150
+ const b = ve(), [, te] = Ee(), {
154
151
  e: F,
155
152
  b: i,
156
- be: L
157
- } = aa("ap-table"), E = oa("valueTypeMap"), {
158
- height: le,
159
- contentRef: ne
160
- } = Je(), x = P(a.size), u = P([]), K = P([]);
161
- _e({
162
- columns: s(() => u.value),
163
- columnsBackup: s(() => K.value),
153
+ be: E
154
+ } = Ze("ap-table"), K = _e("valueTypeMap"), {
155
+ height: re,
156
+ contentRef: le
157
+ } = Ge(), x = z(a.size), d = z([]), L = z([]);
158
+ Ye({
159
+ columns: s(() => d.value),
160
+ columnsBackup: s(() => L.value),
164
161
  size: s(() => x.value),
165
162
  updateColumns(e) {
166
- u.value = e;
163
+ d.value = e;
167
164
  },
168
165
  updateSize(e) {
169
166
  x.value = e;
170
167
  }
171
168
  });
172
- const se = () => {
169
+ const ne = () => {
173
170
  var r;
174
171
  let e = ((r = a.columns) == null ? void 0 : r.filter((l) => !l.hideInTable)) || [];
175
- function o(l, d) {
172
+ function o(l, u) {
176
173
  return l.map((n) => ({
177
- resizable: Ye(n.resizable) ? n.resizable : a.columnResizable,
178
- ..._(De(n), ["ellipsis"]),
179
- fixed: d ? d.fixed : n.fixed,
180
- title: je(n, L("table-header", "title"), b.headerCell, t(te).colorPrimary),
174
+ resizable: Qe(n.resizable) ? n.resizable : a.columnResizable,
175
+ ..._(Ve(n), ["ellipsis"]),
176
+ fixed: u ? u.fixed : n.fixed,
177
+ title: De(n, E("table-header", "title"), b.headerCell, t(te).colorPrimary),
181
178
  customRender({
182
179
  value: p,
183
180
  ...y
184
181
  }) {
185
182
  var H, q;
186
- const W = Ae(n), be = We({
183
+ const W = je(n), Se = Ae({
187
184
  ...n,
188
185
  valueType: W
189
186
  }, {
190
187
  value: p,
191
188
  ...y
192
- }), Re = $e(W, be, y.record, t(E)), $ = ((H = n.renderText) == null ? void 0 : H.call(n, {
189
+ }), be = We(W, Se, y.record, t(K)), $ = ((H = n.renderText) == null ? void 0 : H.call(n, {
193
190
  value: p,
194
191
  ...y
195
- })) || p, ve = n.renderText ? f(U, null, [(q = n.renderText) == null ? void 0 : q.call(n, {
192
+ })) || p, Re = n.renderText ? f(U, null, [(q = n.renderText) == null ? void 0 : q.call(n, {
196
193
  value: p,
197
194
  ...y
198
- })]) : Re;
199
- let z = ye(n, $, ve);
200
- return n.customRender && (z = n.customRender({
195
+ })]) : be;
196
+ let k = ge(n, $, Re);
197
+ return n.customRender && (k = n.customRender({
201
198
  value: p,
202
199
  ...y,
203
200
  column: n,
204
- originalNode: z,
201
+ originalNode: k,
205
202
  originalText: $
206
- })), z;
203
+ })), k;
207
204
  },
208
- children: o(n.children || [], d || n)
205
+ children: o(n.children || [], u || n)
209
206
  }));
210
207
  }
211
208
  return o(e);
212
209
  };
213
- Fe(() => {
214
- const e = se();
215
- u.value = e, K.value = e;
210
+ Te(() => {
211
+ const e = ne();
212
+ d.value = e, L.value = e;
216
213
  });
217
214
  const O = s(() => {
218
215
  var e, o, r;
219
- return N++, ((r = (o = (e = a.columns) == null ? void 0 : e.filter((l) => !l.hideInSearch && l.dataIndex && (l.valueType || l.customRenderFormItem) && !Z.includes(l.valueType))) == null ? void 0 : o.sort((l, d) => {
216
+ return N++, ((r = (o = (e = a.columns) == null ? void 0 : e.filter((l) => !l.hideInSearch && l.dataIndex && (l.valueType || l.customRenderFormItem) && !Z.includes(l.valueType))) == null ? void 0 : o.sort((l, u) => {
220
217
  let n = ee(l.order);
221
- return ee(d.order) - n;
218
+ return ee(u.order) - n;
222
219
  })) == null ? void 0 : r.map((l) => {
223
- const d = He(l, qe(l.fieldProps, {})), n = {
220
+ const u = $e(l, He(l.fieldProps, {})), n = {
224
221
  ...l,
225
222
  fieldProps: {
226
223
  label: l.title,
227
224
  name: l.dataIndex,
228
- ...d || {},
229
- // 格式化placeholder
230
- placeholder: Ue(re, l.valueType, d == null ? void 0 : d.placeholder),
225
+ ...u || {},
231
226
  _signal: N
232
227
  },
233
228
  renderNode: void 0
234
229
  };
235
- return n.renderNode = Ge(n, t(E)), n;
230
+ return n.renderNode = qe(n, t(K)), n;
236
231
  })) || [];
237
- }), de = s(() => t(u).filter((e) => e.sorter === !0).map((e) => e.dataIndex).filter(Boolean)), ue = s(() => t(u).filter((e) => e.filters && !e.onFilter).map((e) => e.dataIndex).filter(Boolean)), ie = s(() => g(a.dataSource) ? C.value.records : a.dataSource), {
232
+ }), se = s(() => t(d).filter((e) => e.sorter === !0).map((e) => e.dataIndex).filter(Boolean)), de = s(() => t(d).filter((e) => e.filters && !e.onFilter).map((e) => e.dataIndex).filter(Boolean)), ue = s(() => g(a.dataSource) ? v.value.records : a.dataSource), {
238
233
  rowSelection: R,
239
234
  selectedRows: B,
240
- ...v
241
- } = Xe({
235
+ ...C
236
+ } = Je({
242
237
  ...a.rowSelection === !0 ? {} : a.rowSelection,
243
238
  rowKey: a.rowKey,
244
- dataSource: ie
239
+ dataSource: ue
245
240
  }), {
246
- formRef: k,
241
+ formRef: P,
247
242
  submit: V,
248
243
  reset: D,
249
244
  tableProps: j,
250
- refresh: ce,
251
- data: C,
252
- setDataSource: pe
253
- } = Oe({
245
+ refresh: ie,
246
+ data: v,
247
+ setDataSource: ce
248
+ } = Le({
254
249
  async request(e) {
255
250
  var r, l;
256
- if (!R.value.preserveSelectedRowKeys && g(a.dataSource) && v.clearAll(), !g(a.dataSource))
251
+ if (!R.value.preserveSelectedRowKeys && g(a.dataSource) && C.clearAll(), !g(a.dataSource))
257
252
  return {
258
253
  data: a.dataSource || [],
259
254
  total: a.dataSource.length || 0
@@ -264,8 +259,8 @@ const Fa = /* @__PURE__ */ Ce({
264
259
  total: (o == null ? void 0 : o.total) || 0
265
260
  };
266
261
  },
267
- filterFields: ue,
268
- sortFields: de,
262
+ filterFields: de,
263
+ sortFields: se,
269
264
  defaultParams: a.params,
270
265
  defaultData: a.defaultData,
271
266
  manual: a.manual,
@@ -274,16 +269,16 @@ const Fa = /* @__PURE__ */ Ce({
274
269
  formatParams: a.beforeSearchSubmit,
275
270
  showLessItems: a.pagination ? a.pagination.showLessItems : void 0,
276
271
  showTotal: a.pagination ? a.pagination.showTotal : void 0
277
- }), fe = s(() => {
272
+ }), pe = s(() => {
278
273
  var o, r;
279
- if (a.adaptive && (C.value.total > 0 || ((o = a.dataSource) == null ? void 0 : o.length)))
274
+ if (a.adaptive && (v.value.total > 0 || ((o = a.dataSource) == null ? void 0 : o.length)))
280
275
  return {
281
- y: t(le),
276
+ y: t(re),
282
277
  x: ((r = a.scroll) == null ? void 0 : r.x) || "100%"
283
278
  };
284
279
  if (a.scroll)
285
280
  return a.scroll;
286
- }), me = s(() => {
281
+ }), fe = s(() => {
287
282
  var e;
288
283
  if (a.tableLayout)
289
284
  return a.tableLayout;
@@ -302,73 +297,73 @@ const Fa = /* @__PURE__ */ Ce({
302
297
  } : a.rowSelection,
303
298
  loading: g(a.loading) ? e.loading : a.loading,
304
299
  pagination: a.pagination === !1 ? !1 : e.pagination,
305
- scroll: t(fe)
300
+ scroll: t(pe)
306
301
  };
307
- }), ge = s(() => [i(), a.card ? null : i("wrapper"), a.adaptive ? i("adaptive") : null].filter(Boolean));
308
- function ye(e, o, r) {
302
+ }), me = s(() => [i(), a.card ? null : i("wrapper"), a.adaptive ? i("adaptive") : null].filter(Boolean));
303
+ function ge(e, o, r) {
309
304
  if (Z.includes(e.valueType))
310
305
  return r;
311
- const l = Me(o);
312
- return e.copyable || e.ellipsis ? f(Pe.Paragraph, {
306
+ const l = Ue(o);
307
+ return e.copyable || e.ellipsis ? f(ke.Paragraph, {
313
308
  copyable: e.copyable ? {
314
309
  text: l,
315
310
  tooltip: !1
316
311
  } : !1,
317
- ellipsis: e.ellipsis ? Ve(e.ellipsis) ? {
312
+ ellipsis: e.ellipsis ? Oe(e.ellipsis) ? {
318
313
  tooltip: l
319
314
  } : {
320
315
  ...e.ellipsis,
321
316
  tooltip: l
322
317
  } : !1,
323
- content: e.ellipsis ? Qe(e, o) : r
318
+ content: e.ellipsis ? Me(e, o) : r
324
319
  }, null) : r;
325
320
  }
326
- G(() => t(C).loading, (e) => {
321
+ G(() => t(v).loading, (e) => {
327
322
  var o;
328
323
  (o = a.onLoadingChange) == null || o.call(a, e);
329
324
  }), G(() => a.dataSource, (e) => {
330
- pe(e);
325
+ ce(e);
331
326
  }, {
332
327
  immediate: !0
333
328
  });
334
- function he(e) {
329
+ function ye(e) {
335
330
  var o, r, l;
336
- (l = (r = (o = k.value) == null ? void 0 : o.apForm) == null ? void 0 : r.setFieldsValue) == null || l.call(r, e);
331
+ (l = (r = (o = P.value) == null ? void 0 : o.apForm) == null ? void 0 : r.setFieldsValue) == null || l.call(r, e);
337
332
  }
338
- function we() {
333
+ function he() {
339
334
  var e, o, r;
340
- return (r = (o = (e = k.value) == null ? void 0 : e.apForm) == null ? void 0 : o.getFieldsValue) == null ? void 0 : r.call(o, !0);
335
+ return (r = (o = (e = P.value) == null ? void 0 : e.apForm) == null ? void 0 : o.getFieldsValue) == null ? void 0 : r.call(o, !0);
341
336
  }
342
- function Se() {
343
- return t(u);
337
+ function we() {
338
+ return t(d);
344
339
  }
345
340
  return oe({
346
341
  submit: () => V(),
347
342
  reset: () => D(),
348
- refresh: () => ce(),
349
- setSearchFormValues: he,
350
- getSearchFormValues: we,
351
- getShownColumns: Se,
352
- dataSource: s(() => t(C).records),
343
+ refresh: () => ie(),
344
+ setSearchFormValues: ye,
345
+ getSearchFormValues: he,
346
+ getShownColumns: we,
347
+ dataSource: s(() => t(v).records),
353
348
  rowSelection: {
354
349
  selectedRows: s(() => t(B)),
355
- ...v
350
+ ...C
356
351
  }
357
352
  }), (e, o) => (m(), T("div", {
358
- class: c(ge.value)
353
+ class: c(me.value)
359
354
  }, [t(g)(e.dataSource) && e.searchForm !== !1 && O.value.length > 0 ? (m(), T("div", {
360
355
  key: 0,
361
356
  class: c(e.card ? t(F)("search-wrapper") : null),
362
357
  style: M(e.searchFormWrapperStyle)
363
358
  }, [f(t(Ke).SearchForm, h(e.searchForm || {}, {
364
359
  ref_key: "formRef",
365
- ref: k,
360
+ ref: P,
366
361
  "custom-reset": "",
367
362
  onSubmit: t(V),
368
363
  onReset: t(D),
369
364
  "submit-loading": t(j).loading
370
365
  }), J({
371
- default: w(() => [(m(!0), T(U, null, Q(O.value, (r) => (m(), X(xe(r.renderNode), h({
366
+ default: w(() => [(m(!0), T(U, null, Q(O.value, (r) => (m(), X(Fe(r.renderNode), h({
372
367
  key: r.dataIndex,
373
368
  ref_for: !0
374
369
  }, r.fieldProps || {}, {
@@ -381,7 +376,7 @@ const Fa = /* @__PURE__ */ Ce({
381
376
  key: "0"
382
377
  } : void 0]), 1040, ["onSubmit", "onReset", "submit-loading"])], 6)) : Y("", !0), I("div", {
383
378
  ref_key: "contentRef",
384
- ref: ne,
379
+ ref: le,
385
380
  class: c([t(F)("table-wrapper"), e.card ? t(F)("table-wrapper-card") : null]),
386
381
  style: M(e.tableWrapperStyle)
387
382
  }, [I("div", {
@@ -390,46 +385,46 @@ const Fa = /* @__PURE__ */ Ce({
390
385
  key: 0,
391
386
  class: c(t(i)("header"))
392
387
  }, [I("div", {
393
- class: c(t(L)("header", "title"))
388
+ class: c(t(E)("header", "title"))
394
389
  }, [S(e.$slots, "title", h({
395
390
  selectedRows: t(B),
396
391
  selectedRowKeys: t(R).selectedRowKeys,
397
- shownColumns: u.value
398
- }, v))], 2), b.title ? (m(), X(t(Ie), {
392
+ shownColumns: d.value
393
+ }, C))], 2), b.title ? (m(), X(t(ze), {
399
394
  key: 0,
400
395
  type: "vertical"
401
- })) : Y("", !0), f(ta, {
396
+ })) : Y("", !0), f(ea, {
402
397
  config: e.settings === !0 ? {} : e.settings
403
398
  }, {
404
- trigger: w(() => [f(t(Ne), {
399
+ trigger: w(() => [f(t(Ie), {
405
400
  class: c(t(i)("setting-trigger-button")),
406
- icon: Be(t(Ze))
401
+ icon: xe(t(Xe))
407
402
  }, null, 8, ["class", "icon"])]),
408
403
  _: 1
409
404
  }, 8, ["config"])], 2)) : S(e.$slots, "title", h({
410
405
  key: 1,
411
406
  selectedRows: t(B),
412
407
  selectedRowKeys: t(R).selectedRowKeys,
413
- shownColumns: u.value
414
- }, v))], 2), f(t(Le), h({
408
+ shownColumns: d.value
409
+ }, C))], 2), f(t(Ne), h({
415
410
  class: t(i)("table")
416
411
  }, A.value, {
417
412
  size: x.value,
418
- "table-layout": me.value,
419
- columns: u.value,
413
+ "table-layout": fe.value,
414
+ columns: d.value,
420
415
  onResizeColumn: o[0] || (o[0] = (r, l) => l.width = r)
421
416
  }), J({
422
417
  summary: w(() => [S(e.$slots, "summary", {
423
- columns: u.value,
418
+ columns: d.value,
424
419
  records: A.value.dataSource
425
420
  })]),
426
421
  _: 2
427
422
  }, [Q(t(_)(b, ["title", "searchFormExtra", "headerCell", "summary"]), (r, l) => ({
428
423
  name: l,
429
- fn: w((d) => [S(e.$slots, l, ke(ze(d || {})))])
424
+ fn: w((u) => [S(e.$slots, l, Be(Pe(u || {})))])
430
425
  }))]), 1040, ["class", "size", "table-layout", "columns"])], 6)], 2));
431
426
  }
432
427
  });
433
428
  export {
434
- Fa as default
429
+ Ra as default
435
430
  };