@aplus-frontend/ui 7.12.6 → 7.13.1

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 (168) hide show
  1. package/es/src/ag-grid/components/loading/index.vue.d.ts +3 -0
  2. package/es/src/ag-grid/components/loading/index.vue.mjs +4 -0
  3. package/es/src/ag-grid/components/loading/index.vue2.mjs +18 -0
  4. package/es/src/ag-grid/context.mjs +1 -1
  5. package/es/src/ag-grid/editable/form-item.vue.mjs +33 -31
  6. package/es/src/ag-grid/editable/index.vue.mjs +1 -0
  7. package/es/src/ag-grid/hooks/use-pinned-row.mjs +2 -2
  8. package/es/src/ag-grid/index.vue.mjs +209 -202
  9. package/es/src/ag-grid/interface.d.ts +4 -0
  10. package/es/src/ag-grid/style/index.mjs +8 -5
  11. package/es/src/ap-drawer/interface.d.ts +13 -2
  12. package/es/src/ap-drawer/utils/createDrawer.mjs +37 -32
  13. package/es/src/ap-field/select/index.vue.d.ts +1 -2
  14. package/es/src/ap-field/select/index.vue.mjs +126 -88
  15. package/es/src/ap-field/style/index.mjs +8 -6
  16. package/es/src/ap-field/style/select.d.ts +2 -0
  17. package/es/src/ap-field/style/select.mjs +43 -0
  18. package/es/src/ap-form/context.mjs +1 -1
  19. package/es/src/ap-form/item-group/helper.mjs +2 -2
  20. package/es/src/ap-form/items/select/index.vue.d.ts +4 -8
  21. package/es/src/ap-form/provider/context.mjs +1 -1
  22. package/es/src/ap-grid/utils/table.mjs +2 -2
  23. package/es/src/ap-pro-card/components/card/index.vue2.mjs +2 -2
  24. package/es/src/ap-table/ap-table.vue2.mjs +15 -16
  25. package/es/src/ap-table/components/setting/context.d.ts +17 -0
  26. package/es/src/ap-table/components/setting/context.mjs +18 -0
  27. package/es/src/ap-table/components/setting/modal/index.vue.d.ts +1 -1
  28. package/es/src/ap-table/components/setting/modal/index.vue2.mjs +220 -88
  29. package/es/src/ap-table/components/setting/sorter/context.mjs +1 -1
  30. package/es/src/ap-table/components/setting/sorter/index.vue2.mjs +49 -51
  31. package/es/src/ap-table/components/setting/template/edit-form.vue.d.ts +844 -0
  32. package/es/src/ap-table/components/setting/template/edit-form.vue.mjs +4 -0
  33. package/es/src/ap-table/components/setting/template/edit-form.vue2.mjs +74 -0
  34. package/es/src/ap-table/components/setting/template/index.vue.d.ts +11 -0
  35. package/es/src/ap-table/components/setting/template/index.vue.mjs +4 -0
  36. package/es/src/ap-table/components/setting/template/index.vue2.mjs +51 -0
  37. package/es/src/ap-table/components/setting/template/item.vue.d.ts +13 -0
  38. package/es/src/ap-table/components/setting/template/item.vue.mjs +4 -0
  39. package/es/src/ap-table/components/setting/template/item.vue2.mjs +78 -0
  40. package/es/src/ap-table/components/setting/tree-select/index.vue.d.ts +1 -1
  41. package/es/src/ap-table/components/setting/tree-select/index.vue2.mjs +26 -29
  42. package/es/src/ap-table/components/setting/utils.d.ts +1 -0
  43. package/es/src/ap-table/components/setting/utils.mjs +22 -15
  44. package/es/src/ap-table/constants.d.ts +2 -4
  45. package/es/src/ap-table/context.mjs +1 -1
  46. package/es/src/ap-table/hooks/use-table-column-state.d.ts +4 -23
  47. package/es/src/ap-table/hooks/use-table-column-state.mjs +32 -120
  48. package/es/src/ap-table/hooks/use-table-template-storage.d.ts +49 -0
  49. package/es/src/ap-table/hooks/use-table-template-storage.mjs +150 -0
  50. package/es/src/ap-table/interface.d.ts +26 -3
  51. package/es/src/ap-table/style/index.d.ts +1 -0
  52. package/es/src/ap-table/style/index.mjs +2 -1
  53. package/es/src/ap-table/style/setting.d.ts +2 -0
  54. package/es/src/ap-table/style/setting.mjs +114 -19
  55. package/es/src/ap-table/utils.mjs +1 -1
  56. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-instance.mjs +1 -1
  57. package/es/src/business/ag-grid-modal/style/index.mjs +7 -7
  58. package/es/src/business/ap-attachment/ApAttachment.mjs +96 -89
  59. package/es/src/business/ap-attachment/style/index.mjs +33 -16
  60. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.mjs +24 -22
  61. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +1 -1
  62. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue2.mjs +35 -31
  63. package/es/src/business/ap-batch-action-group/index.d.ts +3 -3
  64. package/es/src/business/ap-batch-action-group/interface.d.ts +1 -1
  65. package/es/src/business/ap-download/hooks/index.mjs +1 -1
  66. package/es/src/business/ap-draggable-grid/ApDraggableGrid.vue2.mjs +1 -3
  67. package/es/src/business/ap-keep-alive/hook.mjs +1 -1
  68. package/es/src/business/ap-keep-alive/utils.mjs +1 -1
  69. package/es/src/business/ap-upload/components/MultipleFile.vue2.mjs +19 -19
  70. package/es/src/business/ap-upload/components/Picture.vue2.mjs +34 -34
  71. package/es/src/business/ap-value-select-card/style/index.mjs +3 -2
  72. package/es/src/business/ap-view/components/menu-list-content.vue2.mjs +21 -21
  73. package/es/src/business/ap-view/hooks/use-view-provide.mjs +1 -1
  74. package/es/src/business/ap-view/style/index.mjs +2 -2
  75. package/es/src/check-card/context.mjs +1 -1
  76. package/es/src/config-provider/constants.mjs +1 -1
  77. package/es/src/config-provider/hooks/use-locale.mjs +1 -1
  78. package/es/src/config-provider/hooks/use-namespace.mjs +1 -1
  79. package/es/src/config-provider/hooks/use-token.mjs +1 -1
  80. package/es/src/design-token/index.mjs +5 -5
  81. package/es/src/editable-table/utils.mjs +1 -1
  82. package/es/src/locale/lang/en.mjs +15 -4
  83. package/es/src/locale/lang/zh-cn.mjs +18 -7
  84. package/es/src/text/context.mjs +1 -1
  85. package/es/src/time-ago/useTimeAgo.mjs +26 -27
  86. package/es/src/utils/data-range-persets.d.ts +13 -1
  87. package/es/src/utils/data-range-persets.mjs +80 -60
  88. package/es/src/utils/index.d.ts +1 -0
  89. package/es/src/utils/index.mjs +56 -48
  90. package/es/src/utils/retry.d.ts +12 -0
  91. package/es/src/utils/retry.mjs +27 -0
  92. package/es/src/utils/slot.mjs +1 -1
  93. package/es/src/version.d.ts +1 -1
  94. package/es/src/version.mjs +1 -1
  95. package/lib/src/ag-grid/components/loading/index.vue.d.ts +3 -0
  96. package/lib/src/ag-grid/components/loading/index.vue.js +1 -0
  97. package/lib/src/ag-grid/components/loading/index.vue2.js +1 -0
  98. package/lib/src/ag-grid/editable/form-item.vue.js +1 -1
  99. package/lib/src/ag-grid/editable/index.vue.js +1 -1
  100. package/lib/src/ag-grid/hooks/use-pinned-row.js +1 -1
  101. package/lib/src/ag-grid/index.vue.js +1 -1
  102. package/lib/src/ag-grid/interface.d.ts +4 -0
  103. package/lib/src/ag-grid/style/index.js +1 -1
  104. package/lib/src/ap-drawer/interface.d.ts +13 -2
  105. package/lib/src/ap-drawer/utils/createDrawer.js +1 -1
  106. package/lib/src/ap-field/select/index.vue.d.ts +1 -2
  107. package/lib/src/ap-field/select/index.vue.js +1 -1
  108. package/lib/src/ap-field/style/index.js +1 -1
  109. package/lib/src/ap-field/style/select.d.ts +2 -0
  110. package/lib/src/ap-field/style/select.js +1 -0
  111. package/lib/src/ap-form/items/select/index.vue.d.ts +4 -8
  112. package/lib/src/ap-grid/utils/table.js +1 -1
  113. package/lib/src/ap-table/ap-table.vue2.js +1 -1
  114. package/lib/src/ap-table/components/setting/context.d.ts +17 -0
  115. package/lib/src/ap-table/components/setting/context.js +1 -0
  116. package/lib/src/ap-table/components/setting/modal/index.vue.d.ts +1 -1
  117. package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
  118. package/lib/src/ap-table/components/setting/sorter/index.vue2.js +1 -1
  119. package/lib/src/ap-table/components/setting/template/edit-form.vue.d.ts +844 -0
  120. package/lib/src/ap-table/components/setting/template/edit-form.vue.js +1 -0
  121. package/lib/src/ap-table/components/setting/template/edit-form.vue2.js +1 -0
  122. package/lib/src/ap-table/components/setting/template/index.vue.d.ts +11 -0
  123. package/lib/src/ap-table/components/setting/template/index.vue.js +1 -0
  124. package/lib/src/ap-table/components/setting/template/index.vue2.js +1 -0
  125. package/lib/src/ap-table/components/setting/template/item.vue.d.ts +13 -0
  126. package/lib/src/ap-table/components/setting/template/item.vue.js +1 -0
  127. package/lib/src/ap-table/components/setting/template/item.vue2.js +1 -0
  128. package/lib/src/ap-table/components/setting/tree-select/index.vue.d.ts +1 -1
  129. package/lib/src/ap-table/components/setting/tree-select/index.vue2.js +1 -1
  130. package/lib/src/ap-table/components/setting/utils.d.ts +1 -0
  131. package/lib/src/ap-table/components/setting/utils.js +1 -1
  132. package/lib/src/ap-table/constants.d.ts +2 -4
  133. package/lib/src/ap-table/hooks/use-table-column-state.d.ts +4 -23
  134. package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
  135. package/lib/src/ap-table/hooks/use-table-template-storage.d.ts +49 -0
  136. package/lib/src/ap-table/hooks/use-table-template-storage.js +1 -0
  137. package/lib/src/ap-table/interface.d.ts +26 -3
  138. package/lib/src/ap-table/style/index.d.ts +1 -0
  139. package/lib/src/ap-table/style/index.js +1 -1
  140. package/lib/src/ap-table/style/setting.d.ts +2 -0
  141. package/lib/src/ap-table/style/setting.js +1 -1
  142. package/lib/src/business/ag-grid-modal/style/index.js +1 -1
  143. package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
  144. package/lib/src/business/ap-attachment/style/index.js +1 -1
  145. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.js +1 -1
  146. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +1 -1
  147. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue2.js +1 -1
  148. package/lib/src/business/ap-batch-action-group/index.d.ts +3 -3
  149. package/lib/src/business/ap-batch-action-group/interface.d.ts +1 -1
  150. package/lib/src/business/ap-draggable-grid/ApDraggableGrid.vue2.js +1 -1
  151. package/lib/src/business/ap-upload/components/MultipleFile.vue2.js +1 -1
  152. package/lib/src/business/ap-upload/components/Picture.vue2.js +1 -1
  153. package/lib/src/business/ap-value-select-card/style/index.js +1 -1
  154. package/lib/src/business/ap-view/components/menu-list-content.vue2.js +1 -1
  155. package/lib/src/business/ap-view/style/index.js +1 -1
  156. package/lib/src/design-token/index.js +1 -1
  157. package/lib/src/locale/lang/en.js +1 -1
  158. package/lib/src/locale/lang/zh-cn.js +1 -1
  159. package/lib/src/time-ago/useTimeAgo.js +1 -1
  160. package/lib/src/utils/data-range-persets.d.ts +13 -1
  161. package/lib/src/utils/data-range-persets.js +1 -1
  162. package/lib/src/utils/index.d.ts +1 -0
  163. package/lib/src/utils/index.js +1 -1
  164. package/lib/src/utils/retry.d.ts +12 -0
  165. package/lib/src/utils/retry.js +1 -0
  166. package/lib/src/version.d.ts +1 -1
  167. package/lib/src/version.js +1 -1
  168. package/package.json +2 -2
@@ -161,7 +161,7 @@ const $e = /* @__PURE__ */ ee({
161
161
  transform: m.value ? "rotate(-90deg)" : "rotate(0deg)"
162
162
  }
163
163
  }, null)]), O = (e, l = []) => {
164
- if (e?.type === Symbol.for("v-fgt")) {
164
+ if (e?.type === /* @__PURE__ */ Symbol.for("v-fgt")) {
165
165
  const r = Array.isArray(e?.children) ? e?.children : [e?.children];
166
166
  if (r?.length)
167
167
  for (let o = 0; o < r.length; o++)
@@ -174,7 +174,7 @@ const $e = /* @__PURE__ */ ee({
174
174
  return E(!1), a(f, null, [e?.reduce((l, r) => {
175
175
  const o = O(r);
176
176
  return [...l, ...o];
177
- }, [])?.filter((l) => l.type !== Symbol.for("v-cmt"))?.map((l, r, o) => {
177
+ }, [])?.filter((l) => l.type !== /* @__PURE__ */ Symbol.for("v-cmt"))?.map((l, r, o) => {
178
178
  if (l && typeof l == "object" && "type" in l && l.type?.isProCard === !0) {
179
179
  E(!0);
180
180
  const c = l?.props?.colSpan || l?.props?.["col-span"] || {}, {
@@ -148,7 +148,6 @@ const Qr = /* @__PURE__ */ je({
148
148
  default: !1
149
149
  },
150
150
  settings: {
151
- type: [Boolean, Object],
152
151
  default: void 0
153
152
  }
154
153
  },
@@ -194,10 +193,10 @@ const Qr = /* @__PURE__ */ je({
194
193
  }).filter(Boolean)), Ce = n(() => pe(o(s), (e) => {
195
194
  if (e.filters && !e.onFilter)
196
195
  return e.key || e?.dataIndex;
197
- }).filter(Boolean)), Te = n(() => g(r.dataSource) ? y.records : r.dataSource), Fe = n(() => fe(r.manual) ? r.manual : Ye(b.searchFormExtra?.() || []).some((a) => a.type?.name === "ApView")), {
196
+ }).filter(Boolean)), Te = n(() => g(r.dataSource) ? y.records : r.dataSource), xe = n(() => fe(r.manual) ? r.manual : Ye(b.searchFormExtra?.() || []).some((a) => a.type?.name === "ApView")), {
198
197
  rowSelection: T,
199
- selectedRows: F,
200
- ...x
198
+ selectedRows: x,
199
+ ...F
201
200
  } = nr({
202
201
  fixed: !0,
203
202
  ...r.rowSelection === !0 ? {} : r.rowSelection,
@@ -210,7 +209,7 @@ const Qr = /* @__PURE__ */ je({
210
209
  tableProps: q,
211
210
  refresh: M,
212
211
  data: y,
213
- setDataSource: xe,
212
+ setDataSource: Fe,
214
213
  getColumnSFConfig: G,
215
214
  sortedInfo: Be,
216
215
  filteredInfo: ke,
@@ -220,7 +219,7 @@ const Qr = /* @__PURE__ */ je({
220
219
  getLastParams: Pe
221
220
  } = lr({
222
221
  async request(e) {
223
- if (!T.value.preserveSelectedRowKeys && g(r.dataSource) && !P.value && x.clearAll(), P.value && (P.value = !1), !g(r.dataSource))
222
+ if (!T.value.preserveSelectedRowKeys && g(r.dataSource) && !P.value && F.clearAll(), P.value && (P.value = !1), !g(r.dataSource))
224
223
  return {
225
224
  data: r.dataSource || [],
226
225
  total: r.dataSource.length || 0
@@ -235,7 +234,7 @@ const Qr = /* @__PURE__ */ je({
235
234
  sortFields: Re,
236
235
  params: _e(r, "params"),
237
236
  defaultData: r.defaultData,
238
- manual: o(Fe),
237
+ manual: o(xe),
239
238
  formatParams: r.beforeSearchSubmit,
240
239
  pagination: r.pagination
241
240
  });
@@ -367,7 +366,7 @@ const Qr = /* @__PURE__ */ je({
367
366
  B(() => o(y).loading, (e) => {
368
367
  r.onLoadingChange?.(e);
369
368
  }), B(() => r.dataSource, (e) => {
370
- xe(e);
369
+ Fe(e);
371
370
  }, {
372
371
  immediate: !0
373
372
  });
@@ -402,8 +401,8 @@ const Qr = /* @__PURE__ */ je({
402
401
  getShownColumns: Oe,
403
402
  dataSource: n(() => o(y).records),
404
403
  rowSelection: {
405
- selectedRows: n(() => o(F)),
406
- ...x
404
+ selectedRows: n(() => o(x)),
405
+ ...F
407
406
  },
408
407
  scrollBar: {
409
408
  x: {
@@ -455,20 +454,20 @@ const Qr = /* @__PURE__ */ je({
455
454
  }, [L("div", {
456
455
  class: m(o(O)("header", "title"))
457
456
  }, [v(e.$slots, "title", z({
458
- selectedRows: o(F),
457
+ selectedRows: o(x),
459
458
  selectedRowKeys: o(T).selectedRowKeys,
460
459
  shownColumns: s.value
461
- }, x))], 2), b.title ? (f(), ue(o(Ge), {
460
+ }, F))], 2), b.title ? (f(), ue(o(Ge), {
462
461
  key: 0,
463
462
  type: "vertical"
464
463
  })) : le("", !0), p(vr, {
465
- config: e.settings === !0 ? {} : e.settings
464
+ config: e.settings
466
465
  }, null, 8, ["config"])], 2)) : v(e.$slots, "title", z({
467
466
  key: 1,
468
- selectedRows: o(F),
467
+ selectedRows: o(x),
469
468
  selectedRowKeys: o(T).selectedRowKeys,
470
469
  shownColumns: s.value
471
- }, x))], 2), p(o(Je), z({
470
+ }, F))], 2), p(o(Je), z({
472
471
  ref_key: "antdTableRef",
473
472
  ref: $,
474
473
  class: o(d)("table")
@@ -481,7 +480,7 @@ const Qr = /* @__PURE__ */ je({
481
480
  summary: w(() => [v(e.$slots, "summary", {
482
481
  columns: s.value,
483
482
  records: Q.value.dataSource,
484
- selectedRows: o(F)
483
+ selectedRows: o(x)
485
484
  })]),
486
485
  _: 2
487
486
  }, [o(j) ? {
@@ -0,0 +1,17 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ import { ApTableSettingType } from '../../interface';
3
+ type ApColumnSettingContextProps = {
4
+ /**
5
+ * 当前选中的模版
6
+ */
7
+ activeKey: Ref<string>;
8
+ /**
9
+ * 缓存设置
10
+ */
11
+ cacheConfig: Ref<ApTableSettingType>;
12
+ deleteTemplate: (key: string) => void;
13
+ };
14
+ export declare const ApColumnSettingContextKey: InjectionKey<ApColumnSettingContextProps>;
15
+ export declare function useProvideApColumnSetting(state: ApColumnSettingContextProps): void;
16
+ export declare function useInjectApColumnSetting(): ApColumnSettingContextProps;
17
+ export {};
@@ -0,0 +1,18 @@
1
+ import { provide as o, inject as i, ref as e } from "vue";
2
+ const t = /* @__PURE__ */ Symbol("ap-column-setting");
3
+ function u(n) {
4
+ o(t, n);
5
+ }
6
+ function m() {
7
+ return i(t, {
8
+ activeKey: e(),
9
+ cacheConfig: e(),
10
+ deleteTemplate: () => {
11
+ }
12
+ });
13
+ }
14
+ export {
15
+ t as ApColumnSettingContextKey,
16
+ m as useInjectApColumnSetting,
17
+ u as useProvideApColumnSetting
18
+ };
@@ -1,6 +1,6 @@
1
1
  import { ApTableSettingModalProps } from '../../interface';
2
2
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
- import { ApTableSettingType } from '../../..';
3
+ import { ApTableSettingType } from '../../../interface';
4
4
  type TableSettingModalSlots = {
5
5
  trigger?: any;
6
6
  };
@@ -1,135 +1,267 @@
1
- import { defineComponent as M, ref as v, unref as e, computed as P, useSlots as q, createVNode as t, cloneVNode as H, createElementBlock as J, openBlock as k, Fragment as Q, createBlock as W, createCommentVNode as X, resolveDynamicComponent as Y, withCtx as r, withDirectives as Z, createElementVNode as s, normalizeClass as i, toDisplayString as m, createTextVNode as S, isRef as ee, vShow as te } from "vue";
2
- import { SettingOutlined as le } from "@ant-design/icons-vue";
3
- import { Button as y, Modal as ae, RadioGroup as ne, RadioButton as T, Divider as x } from "@aplus-frontend/antdv";
1
+ import { defineComponent as re, ref as v, computed as pe, toRef as ue, useSlots as ce, createVNode as l, cloneVNode as me, unref as e, watch as O, createElementBlock as U, openBlock as S, Fragment as de, createBlock as w, createCommentVNode as E, resolveDynamicComponent as A, withCtx as o, withDirectives as fe, createElementVNode as c, normalizeClass as p, toDisplayString as g, createTextVNode as C, isRef as ve, vShow as ge } from "vue";
2
+ import { SettingOutlined as ye, SaveOutlined as Se } from "@ant-design/icons-vue";
3
+ import { Button as P, Modal as Te, Divider as B, RadioGroup as be, RadioButton as j, Flex as ke, Space as F, Popover as Ce } from "@aplus-frontend/antdv";
4
+ import "../../../../ap-button/index.mjs";
5
+ import { randomStr as he } from "../../../../utils/index.mjs";
4
6
  import "../../../../config-provider/index.mjs";
5
- import { getSingleVNode as oe } from "../../../../utils/slot.mjs";
6
- import { useInjectApTable as se } from "../../../context.mjs";
7
- import { useTableColumnState as ie } from "../../../hooks/use-table-column-state.mjs";
8
- import re from "../../../style/setting.mjs";
7
+ import { getSingleVNode as _e } from "../../../../utils/slot.mjs";
8
+ import { useInjectApTable as ze } from "../../../context.mjs";
9
+ import { useTableColumnState as xe } from "../../../hooks/use-table-column-state.mjs";
10
+ import { useTableTemplateStorage as we } from "../../../hooks/use-table-template-storage.mjs";
11
+ import Ae from "../../../style/setting.mjs";
12
+ import { useProvideApColumnSetting as Be } from "../context.mjs";
9
13
  import "../sorter/index.vue.mjs";
14
+ import "../template/edit-form.vue.mjs";
15
+ import "../template/index.vue.mjs";
10
16
  import "../tree-select/index.vue.mjs";
11
- import ue, { customCloneColumnStates as B } from "../utils.mjs";
12
- import { useLocale as pe } from "../../../../config-provider/hooks/use-locale.mjs";
13
- import { useNamespace as N } from "../../../../config-provider/hooks/use-namespace.mjs";
14
- import ce from "../tree-select/index.vue2.mjs";
15
- import me from "../sorter/index.vue2.mjs";
16
- const we = /* @__PURE__ */ M({
17
+ import Ne, { customCloneColumnStates as N, isEqualColumnStateIgnoreLabel as Ie } from "../utils.mjs";
18
+ import { useLocale as $e } from "../../../../config-provider/hooks/use-locale.mjs";
19
+ import { useNamespace as M } from "../../../../config-provider/hooks/use-namespace.mjs";
20
+ import Ke from "../template/index.vue2.mjs";
21
+ import Le from "../tree-select/index.vue2.mjs";
22
+ import Re from "../sorter/index.vue2.mjs";
23
+ import Ve from "../../../../ap-button/ap-button.vue.mjs";
24
+ import De from "../template/edit-form.vue2.mjs";
25
+ const Oe = {
26
+ style: {
27
+ "padding-inline": "8px"
28
+ }
29
+ }, pt = /* @__PURE__ */ re({
17
30
  name: "ApTableSetting",
18
31
  __name: "index",
19
32
  props: {
20
33
  config: {
21
- default: () => ({})
34
+ default: () => ({
35
+ persistenceKey: ""
36
+ })
22
37
  }
23
38
  },
24
- setup(_) {
25
- const d = _, {
26
- columnsBackup: w,
27
- size: z,
28
- updateSize: A,
29
- updateColumns: V
30
- } = se(), f = v(e(z)), R = P(() => d.config.persistenceKey), {
31
- columnState: a,
32
- setColumnState: D,
33
- isAllSelected: O,
34
- toggleSelectAll: $,
35
- columnStateBackup: I,
36
- setColumnStateBackup: U,
37
- cacheColumnStateIfNeeded: E
38
- } = ie(d.config, R, []), {
39
- t: n
40
- } = pe(), {
41
- b: u,
42
- be: g
43
- } = N("ap-column-setting"), {
44
- b: K
45
- } = N("ap-table"), j = re("ap-column-setting"), p = v(!1), C = v(!1), F = q(), b = oe(F.trigger) || t(y, {
46
- icon: t(le, null, null),
47
- class: K("setting-trigger-button")
48
- }, null), h = b ? H(b, {
39
+ setup(q) {
40
+ const T = q, {
41
+ columnsBackup: G,
42
+ updateSize: H,
43
+ updateColumns: J
44
+ } = ze(), m = v(), h = pe(() => T.config.persistenceKey), _ = `${h.value}__active_key`, b = v(!1), {
45
+ basicTemplate: Q,
46
+ customizeTemplateList: d,
47
+ addTemplate: W,
48
+ deleteTemplate: I,
49
+ updateTemplate: X
50
+ } = we(T.config, h), {
51
+ columnState: u,
52
+ setColumnState: $,
53
+ isAllSelected: Y,
54
+ toggleSelectAll: Z
55
+ } = xe([]), i = v(localStorage.getItem(_) ?? d.value?.[0].key);
56
+ Be({
57
+ activeKey: i,
58
+ cacheConfig: ue(T, "config"),
59
+ deleteTemplate: ie
60
+ });
61
+ const {
62
+ t: s
63
+ } = $e(), {
64
+ b: f,
65
+ be: k
66
+ } = M("ap-column-setting"), {
67
+ b: ee
68
+ } = M("ap-table"), te = Ae("ap-column-setting"), y = v(!1), K = v(!1), ae = ce(), L = _e(ae.trigger) || l(P, {
69
+ icon: l(ye, null, null),
70
+ class: ee("setting-trigger-button")
71
+ }, null), R = L ? me(L, {
49
72
  onClick: () => {
50
- p.value = !0;
73
+ y.value = !0;
51
74
  }
52
75
  }) : null;
53
- function G() {
54
- D(B(e(I)));
76
+ function le() {
77
+ $(N(e(Q).columnState));
78
+ }
79
+ function V(a, t) {
80
+ J?.(Ne(e(G), a)), H?.(t);
81
+ }
82
+ function ne() {
83
+ V(e(u), e(m)), y.value = !1;
84
+ const a = N(u.value), t = X(i.value, {
85
+ columnState: a,
86
+ size: m.value
87
+ });
88
+ localStorage.setItem(_, i.value), T.config?.onChange?.(a, t);
89
+ }
90
+ function oe(a) {
91
+ const t = he();
92
+ W({
93
+ key: t,
94
+ label: a,
95
+ columnState: u.value,
96
+ size: m.value
97
+ }), b.value = !1, i.value = t;
98
+ }
99
+ function D(a) {
100
+ const t = [...d.value].find((n) => n?.key === a);
101
+ t && ($(N(t.columnState)), m.value = t.size);
55
102
  }
56
- function L() {
57
- V?.(ue(e(w), e(a))), A?.(e(f)), p.value = !1;
58
- const c = B(a.value);
59
- U(c), E(c), d.config?.onChange?.(c);
103
+ function ie(a) {
104
+ if (a !== i.value) {
105
+ I(a);
106
+ return;
107
+ }
108
+ const t = d.value, n = t.findIndex((x) => x.key === a), r = t[n + 1]?.key ?? t[n - 1]?.key;
109
+ I(a), i.value = r;
110
+ }
111
+ function se(a) {
112
+ if (K.value = a, !a) {
113
+ const t = localStorage.getItem(_);
114
+ t && t !== i.value && (i.value = t);
115
+ }
60
116
  }
61
- return (c, o) => (k(), J(Q, null, [e(h) ? (k(), W(Y(e(h)), {
117
+ O(() => i.value, (a, t) => {
118
+ if (!t && a) {
119
+ const n = [...d.value].find((r) => r?.key === a);
120
+ if (!n)
121
+ return;
122
+ V(n.columnState, n.size);
123
+ }
124
+ D(a);
125
+ }, {
126
+ immediate: !0
127
+ });
128
+ const z = v(!1);
129
+ return O([m, u, y], ([a, t, n]) => {
130
+ if (!n)
131
+ return;
132
+ const r = d.value.find((x) => x.key === i.value);
133
+ r && (r.size !== a || !Ie(t, r.columnState)) ? z.value = !0 : z.value = !1;
134
+ }, {
135
+ deep: !0
136
+ }), (a, t) => (S(), U(de, null, [e(R) ? (S(), w(A(e(R)), {
62
137
  key: 0
63
- })) : X("", !0), t(e(ae), {
64
- open: p.value,
65
- "onUpdate:open": o[2] || (o[2] = (l) => p.value = l),
66
- title: e(n)("ap.apTable.setting.title"),
67
- width: 900,
138
+ })) : E("", !0), l(e(Te), {
139
+ open: y.value,
140
+ "onUpdate:open": t[4] || (t[4] = (n) => y.value = n),
141
+ title: e(s)("ap.apTable.setting.title"),
142
+ width: 1e3,
68
143
  centered: !0,
69
144
  "body-style": {
70
145
  padding: "0px !important",
71
- height: "450px"
146
+ height: "516px"
72
147
  },
73
- "after-open-change": (l) => C.value = l,
74
- "wrap-class-name": `${e(u)()} ${e(j)}`,
75
- onOk: L
148
+ "after-open-change": se,
149
+ "wrap-class-name": `${e(f)()} ${e(te)}`,
150
+ "ok-text": e(s)("ap.apTable.setting.saveAndApply"),
151
+ onOk: ne
76
152
  }, {
77
- default: r(() => [Z(s("div", {
78
- class: i(e(u)("wrapper"))
79
- }, [s("div", {
80
- class: i(e(u)("left"))
81
- }, [s("div", {
82
- class: i(e(g)("left", "header"))
83
- }, [s("div", null, [s("span", {
84
- class: i(e(g)("left", "header-tips"))
85
- }, m(e(n)("ap.apTable.setting.selectAllTip")), 3), t(e(y), {
153
+ footer: o(({
154
+ extra: n
155
+ }) => [l(e(ke), {
156
+ justify: "space-between"
157
+ }, {
158
+ default: o(() => [l(e(F), {
159
+ size: 12
160
+ }, {
161
+ default: o(() => [l(e(Ce), {
162
+ open: b.value,
163
+ "onUpdate:open": t[3] || (t[3] = (r) => b.value = r),
164
+ trigger: "click",
165
+ arrow: !1,
166
+ placement: "topLeft",
167
+ "destroy-tooltip-on-hide": ""
168
+ }, {
169
+ content: o(() => [l(De, {
170
+ onConfirm: oe,
171
+ onCancel: t[2] || (t[2] = () => b.value = !1)
172
+ })]),
173
+ default: o(() => [l(e(Ve), {
174
+ type: "borderLink",
175
+ disabled: !a.config.persistenceKey
176
+ }, {
177
+ icon: o(() => [l(e(Se))]),
178
+ default: o(() => [C(g(e(s)("ap.apTable.setting.saveAsTemplate")) + " ", 1)]),
179
+ _: 1
180
+ }, 8, ["disabled"])]),
181
+ _: 1
182
+ }, 8, ["open"]), z.value ? (S(), U("span", {
183
+ key: 0,
184
+ class: p(e(f)("modify-tip"))
185
+ }, g(e(s)("ap.apTable.setting.modifyNotification")), 3)) : E("", !0)]),
186
+ _: 1
187
+ }), l(e(F), {
188
+ size: 10
189
+ }, {
190
+ default: o(() => [(S(), w(A(n.cancelBtn))), (S(), w(A(n.okBtn)))]),
191
+ _: 2
192
+ }, 1024)]),
193
+ _: 2
194
+ }, 1024)]),
195
+ default: o(() => [fe(c("div", {
196
+ class: p(e(f)("wrapper"))
197
+ }, [c("div", {
198
+ class: p(e(f)("left"))
199
+ }, [l(Ke, {
200
+ "customize-template-list": e(d),
201
+ "persistence-key": h.value,
202
+ onActiveChange: D
203
+ }, null, 8, ["customize-template-list", "persistence-key"])], 2), l(e(B), {
204
+ type: "vertical",
205
+ style: {
206
+ height: "100%",
207
+ margin: "0px"
208
+ }
209
+ }), c("div", {
210
+ class: p(e(f)("center"))
211
+ }, [c("div", {
212
+ class: p(e(k)("center", "header"))
213
+ }, [c("div", {
214
+ class: p(e(k)("center", "tip-wrapper"))
215
+ }, [c("span", {
216
+ class: p(e(k)("center", "header-tips"))
217
+ }, g(e(s)("ap.apTable.setting.selectAllTip")), 3), l(e(P), {
86
218
  type: "link",
87
219
  size: "small",
88
- onClick: e($)
220
+ onClick: e(Z)
89
221
  }, {
90
- default: r(() => [S(m(e(O) ? e(n)("ap.apTable.setting.unSelectAll") : e(n)("ap.apTable.setting.selectAll")), 1)]),
222
+ default: o(() => [C(g(e(Y) ? e(s)("ap.apTable.setting.unSelectAll") : e(s)("ap.apTable.setting.selectAll")), 1)]),
91
223
  _: 1
92
- }, 8, ["onClick"])]), t(e(ne), {
93
- value: f.value,
94
- "onUpdate:value": o[0] || (o[0] = (l) => f.value = l)
224
+ }, 8, ["onClick"])], 2), l(e(be), {
225
+ value: m.value,
226
+ "onUpdate:value": t[0] || (t[0] = (n) => m.value = n)
95
227
  }, {
96
- default: r(() => [t(e(T), {
228
+ default: o(() => [l(e(j), {
97
229
  value: "small"
98
230
  }, {
99
- default: r(() => [S(m(e(n)("ap.apTable.setting.sizeSmall")), 1)]),
231
+ default: o(() => [C(g(e(s)("ap.apTable.setting.sizeSmall")), 1)]),
100
232
  _: 1
101
- }), t(e(T), {
233
+ }), l(e(j), {
102
234
  value: "middle"
103
235
  }, {
104
- default: r(() => [S(m(e(n)("ap.apTable.setting.sizeNormal")), 1)]),
236
+ default: o(() => [C(g(e(s)("ap.apTable.setting.sizeNormal")), 1)]),
105
237
  _: 1
106
238
  })]),
107
239
  _: 1
108
- }, 8, ["value"])], 2), t(e(x), {
240
+ }, 8, ["value"])], 2), c("div", Oe, [l(e(B), {
109
241
  dashed: "",
110
242
  style: {
111
243
  margin: "0px"
112
244
  }
113
- }), t(ce, {
114
- class: i(e(g)("left", "content")),
115
- value: e(a)
116
- }, null, 8, ["class", "value"])], 2), t(e(x), {
245
+ })]), l(Le, {
246
+ class: p(e(k)("center", "content")),
247
+ value: e(u)
248
+ }, null, 8, ["class", "value"])], 2), l(e(B), {
117
249
  type: "vertical",
118
250
  style: {
119
251
  height: "100%",
120
252
  margin: "0px"
121
253
  }
122
- }), s("div", {
123
- class: i(e(u)("right"))
124
- }, [t(me, {
125
- value: e(a),
126
- "onUpdate:value": o[1] || (o[1] = (l) => ee(a) ? a.value = l : null),
127
- onReset: G
128
- }, null, 8, ["value"])], 2)], 2), [[te, C.value]])]),
254
+ }), c("div", {
255
+ class: p(e(f)("right"))
256
+ }, [l(Re, {
257
+ value: e(u),
258
+ "onUpdate:value": t[1] || (t[1] = (n) => ve(u) ? u.value = n : null),
259
+ onReset: le
260
+ }, null, 8, ["value"])], 2)], 2), [[ge, K.value]])]),
129
261
  _: 1
130
- }, 8, ["open", "title", "after-open-change", "wrap-class-name"])], 64));
262
+ }, 8, ["open", "title", "wrap-class-name", "ok-text"])], 64));
131
263
  }
132
264
  });
133
265
  export {
134
- we as default
266
+ pt as default
135
267
  };
@@ -1,5 +1,5 @@
1
1
  import { provide as o, inject as r } from "vue";
2
- const e = Symbol("apTableSorterContextKey");
2
+ const e = /* @__PURE__ */ Symbol("apTableSorterContextKey");
3
3
  function i(t) {
4
4
  o(e, t);
5
5
  }