@otwb/ui 2.0.36 → 2.0.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.
@@ -8,10 +8,10 @@ import { useRoute } from "vue-router";
8
8
  import { VOverflow, VResizeObserver } from "vueuc";
9
9
  import { Sortable } from "sortablejs/modular/sortable.core.esm.js";
10
10
  import { request } from "@otwb/common/request";
11
+ import { useApp } from "@otwb/app/use-app";
11
12
  import { pickProps } from "@otwb/common/object";
12
13
  import { PAGE_INJECTION, useFormModal } from "@otwb/page";
13
14
  import { Sortable as Sortable$1 } from "sortablejs";
14
- import "lg.table-plus";
15
15
  import useLocale from "ithinkdt-ui/es/_mixins/use-locale.mjs";
16
16
  import { flattenTree, walkTree } from "@otwb/common";
17
17
  const NCheckboxes = /* @__PURE__ */ defineComponent({
@@ -408,27 +408,30 @@ const DataCustom = /* @__PURE__ */ defineComponent({
408
408
  save: ""
409
409
  },
410
410
  setup(x, { emit: S }) {
411
- let { t: C } = useI18n(), w = useRoute(), T = useMessage();
412
- function E() {
411
+ let { t: C } = useI18n(), w = useRoute(), T = useMessage(), E = useApp();
412
+ function D() {
413
413
  if (x.showFixed) {
414
414
  w.name + "";
415
415
  let e = w.name + "__table";
416
416
  request.post("/api/v1/otwb-cloud-uc/cli/module/custom-config/save", {
417
417
  __table: localStorage.getItem(e),
418
418
  url: w.name
419
- }, { requestType: "json" }).then((e) => {
419
+ }, {
420
+ requestType: "json",
421
+ headers: { Authorization: `Bearer ${E.auth.token}` }
422
+ }).then((e) => {
420
423
  T.success("配置保存成功!");
421
424
  });
422
425
  } else S("save");
423
426
  }
424
- function D(e, b, C) {
427
+ function k(e, b, C) {
425
428
  S("custom", {
426
429
  key: e[x.keyField],
427
430
  [b]: C
428
431
  });
429
432
  }
430
- let k = ref();
431
- return watch(k, (e) => {
433
+ let A = ref();
434
+ return watch(A, (e) => {
432
435
  e.$el && Sortable.create(e.$el, {
433
436
  animation: 150,
434
437
  ghostClass: "ghost",
@@ -460,14 +463,14 @@ const DataCustom = /* @__PURE__ */ defineComponent({
460
463
  text: !0,
461
464
  type: "primary",
462
465
  size: "small",
463
- onClick: () => E()
466
+ onClick: () => D()
464
467
  }, { default: () => [createTextVNode("保存")] }), createVNode(NButton, {
465
468
  text: !0,
466
469
  type: "primary",
467
470
  size: "small",
468
471
  onClick: () => S("custom", !0)
469
472
  }, _isSlot$6(e = C("common.page.custom.reset")) ? e : { default: () => [e] })])] }), createVNode(NFlex, {
470
- ref: k,
473
+ ref: A,
471
474
  vertical: !0
472
475
  }, _isSlot$6(b = x.data.filter((e) => e[x.visiblityField] !== !1).map((e) => createVNode(DataCustomItem, {
473
476
  key: e[x.keyField],
@@ -475,8 +478,8 @@ const DataCustom = /* @__PURE__ */ defineComponent({
475
478
  hidden: e[x.hiddenField],
476
479
  fixed: e[x.fixedField],
477
480
  showFixed: x.showFixed,
478
- onUpdateHidden: (b) => D(e, "hidden", b),
479
- onUpdateFixed: (b) => D(e, "fixed", b)
481
+ onUpdateHidden: (b) => k(e, "hidden", b),
482
+ onUpdateFixed: (b) => k(e, "fixed", b)
480
483
  }, null))) ? b : { default: () => [b] })] });
481
484
  }
482
485
  });
@@ -752,69 +755,72 @@ const DataForm = /* @__PURE__ */ defineComponent({
752
755
  "collapse"
753
756
  ],
754
757
  setup(b, { expose: x, emit: S }) {
755
- let C = useRoute(), w = useMessage(), T = () => {
758
+ let C = useRoute(), w = useMessage(), T = useApp(), E = () => {
756
759
  let e = C.name + "__form";
757
760
  C.name + "", request.post("/api/v1/otwb-cloud-uc/cli/module/custom-config/save", {
758
761
  __form: localStorage.getItem(e),
759
762
  url: C.name
760
- }, { requestType: "json" }).then((e) => {
763
+ }, {
764
+ requestType: "json",
765
+ headers: { Authorization: `Bearer ${T.auth.token}` }
766
+ }).then((e) => {
761
767
  w.success("配置保存成功!");
762
768
  });
763
- }, { t: E } = useI18n(), D = (e) => {
769
+ }, { t: D } = useI18n(), k = (e) => {
764
770
  S("filter", b.model, e);
765
- }, k = (e) => {
771
+ }, A = (e) => {
766
772
  S("reset", e), b.filterOnReset && S("filter", b.model, e);
767
- }, A = ref(b.defaultCollapsed), j = (e) => {
768
- A.value = e;
773
+ }, j = ref(b.defaultCollapsed), N = (e) => {
774
+ j.value = e;
769
775
  };
770
- x({ collapse: j });
771
- let N = reactive({
776
+ x({ collapse: N });
777
+ let I = reactive({
772
778
  span: 6,
773
779
  suffix: !0
774
780
  });
775
781
  return () => {
776
- let { filterOnReset: e, filterText: x, resetText: C, customizable: w, defaultCollapsed: P, collapsible: F, grid: I,...L } = b;
782
+ let { filterOnReset: e, filterText: x, resetText: C, customizable: w, defaultCollapsed: T, collapsible: P, grid: F,...L } = b;
777
783
  return createVNode(DataForm, mergeProps({ grid: {
778
784
  cols: "12 768:18 1200:30 1536:30",
779
785
  yGap: 16,
780
786
  xGap: 12,
781
- ...I,
782
- collapsed: A.value
787
+ ...F,
788
+ collapsed: j.value
783
789
  } }, L, {
784
790
  showFeedback: !1,
785
- showAction: N,
786
- onSubmit: D,
787
- onReset: k
788
- }), { action: ({ cols: e, spans: D }) => (N.suffix = e < D + N.span, createVNode(NFlex, {
789
- justify: N.suffix ? "end" : "start",
791
+ showAction: I,
792
+ onSubmit: k,
793
+ onReset: A
794
+ }), { action: ({ cols: e, spans: T }) => (I.suffix = e < T + I.span, createVNode(NFlex, {
795
+ justify: I.suffix ? "end" : "start",
790
796
  align: "center"
791
797
  }, { default: () => [
792
- F && N.suffix ? createVNode(NButton, {
798
+ P && I.suffix ? createVNode(NButton, {
793
799
  class: "collapsedBtn",
794
800
  text: !0,
795
801
  type: "primary",
796
802
  iconPlacement: "right",
797
- renderIcon: A.value ? IDown : IUp,
798
- onClick: () => j(!A.value)
799
- }, { default: () => [A.value ? E("common.page.filter.expand") : E("common.page.filter.collapse")] }) : void 0,
800
- N.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
803
+ renderIcon: j.value ? IDown : IUp,
804
+ onClick: () => N(!j.value)
805
+ }, { default: () => [j.value ? D("common.page.filter.expand") : D("common.page.filter.collapse")] }) : void 0,
806
+ I.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
801
807
  createVNode(NButton, {
802
808
  class: "submitWrap",
803
809
  attrType: "submit",
804
810
  type: "primary",
805
811
  disabled: b.disabled,
806
812
  loading: b.loading
807
- }, { default: () => [x || E("common.page.filter.submitText")] }),
813
+ }, { default: () => [x || D("common.page.filter.submitText")] }),
808
814
  createVNode(NButton, {
809
815
  attrType: "reset",
810
816
  disabled: b.disabled || b.loading
811
- }, { default: () => [C || E("common.page.form.resetText")] }),
817
+ }, { default: () => [C || D("common.page.form.resetText")] }),
812
818
  w ? createVNode(DataCustom, {
813
819
  isFilter: !0,
814
820
  keyField: "name",
815
821
  showFixed: !1,
816
822
  data: L.items,
817
- onSave: T,
823
+ onSave: E,
818
824
  onCustom: (e) => S("custom", e),
819
825
  size: 16,
820
826
  type: "primary"
@@ -938,27 +944,30 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
938
944
  },
939
945
  emits: { change: () => !0 },
940
946
  setup(b, { emit: x }) {
941
- let { t: S } = useI18n(), C = useRoute(), w = (e) => x("change", {
947
+ let { t: S } = useI18n(), C = useRoute(), w = useApp(), T = (e) => x("change", {
942
948
  pageSize: b.pageSize ?? b.page?.pageSize ?? 0,
943
949
  currentPage: e
944
- }), T = (e) => {
950
+ }), E = (e) => {
945
951
  let S = C.name + "__page";
946
952
  request.post("/api/v1/otwb-cloud-uc/cli/module/custom-config/save", {
947
953
  __page: e,
948
954
  url: C.name
949
- }, { requestType: "json" }).then((b) => {
955
+ }, {
956
+ requestType: "json",
957
+ headers: { Authorization: `Bearer ${w.auth.token}` }
958
+ }).then((b) => {
950
959
  localStorage.setItem(S, e);
951
960
  }), x("change", {
952
961
  pageSize: e,
953
962
  currentPage: b.currentPage ?? b.page?.currentPage ?? 0
954
963
  });
955
- }, E = C.name + "__page";
956
- return localStorage.getItem(E) && (b.page.pageSize = localStorage.getItem(E)), () => createVNode(NPagination, {
964
+ }, D = C.name + "__page";
965
+ return localStorage.getItem(D) && (b.page.pageSize = localStorage.getItem(D)), () => createVNode(NPagination, {
957
966
  page: b.currentPage ?? b.page?.currentPage,
958
967
  itemCount: b.total,
959
968
  pageSize: b.pageSize ?? b.page?.pageSize,
960
- onUpdatePage: w,
961
- onUpdatePageSize: T,
969
+ onUpdatePage: T,
970
+ onUpdatePageSize: E,
962
971
  pageSizes: b.pageSizes,
963
972
  showQuickJumper: !0,
964
973
  showSizePicker: !0,
@@ -1174,7 +1183,6 @@ const DataTable = /* @__PURE__ */ defineComponent({
1174
1183
  });
1175
1184
  };
1176
1185
  return () => createVNode(NDataTable, {
1177
- id: "table-wrap",
1178
1186
  class: O,
1179
1187
  data: e.data,
1180
1188
  columns: L.value,
@@ -1,5 +1,5 @@
1
1
  import "./use-i18n-Dx7V4KrY.js";
2
2
  import "./directives-CRvPGywW.js";
3
3
  import "./use-style-DcT-1dj4.js";
4
- import { a as NRadios, c as DataSelection, d as useLocaleEdit, f as DataFilter, g as NCheckboxes, h as DataActions, i as renderUsers, l as DataPagination, m as DataCustom, n as DtUserDept, o as DataTable, p as DataForm, r as DtUserRender, s as useDataTableDrag, t as DtDeptRender, u as DataLocaleInput } from "./components-CkECmA7m.js";
4
+ import { a as NRadios, c as DataSelection, d as useLocaleEdit, f as DataFilter, g as NCheckboxes, h as DataActions, i as renderUsers, l as DataPagination, m as DataCustom, n as DtUserDept, o as DataTable, p as DataForm, r as DtUserRender, s as useDataTableDrag, t as DtDeptRender, u as DataLocaleInput } from "./components-BM8_ejhG.js";
5
5
  export { DataActions, DataCustom, DataFilter, DataForm, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, renderUsers, useDataTableDrag, useLocaleEdit };
package/dist/page.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as useI18n } from "./use-i18n-Dx7V4KrY.js";
2
2
  import "./directives-CRvPGywW.js";
3
3
  import "./use-style-DcT-1dj4.js";
4
- import { a as NRadios, g as NCheckboxes, n as DtUserDept, p as DataForm, r as DtUserRender, t as DtDeptRender } from "./components-CkECmA7m.js";
4
+ import { a as NRadios, g as NCheckboxes, n as DtUserDept, p as DataForm, r as DtUserRender, t as DtDeptRender } from "./components-BM8_ejhG.js";
5
5
  import { computed, createVNode, defineComponent, h, isVNode, mergeProps, nextTick, ref, shallowRef, unref } from "vue";
6
6
  import { until } from "@vueuse/core";
7
7
  import { NButton, NCheckbox, NColorPicker, NDatePicker, NDrawer, NDrawerContent, NFlex, NInput, NInputNumber, NModal, NScrollbar, NSelect, NText, NUpload, useMessage } from "ithinkdt-ui";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otwb/ui",
3
- "version": "2.0.36",
3
+ "version": "2.0.37",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "otwb UI",
@@ -62,11 +62,11 @@
62
62
  "@vicons/antd": "^0.13.0",
63
63
  "@vueuse/core": "^14.0.0",
64
64
  "date-fns": "^4.1.0",
65
- "lg.table-plus": "^0.0.2",
66
65
  "nanoid": "^5.1.6",
67
66
  "sortablejs": "^1.15.6",
68
67
  "vueuc": "^0.4.65",
69
- "@otwb/common": "^2.0.7"
68
+ "@otwb/common": "^2.0.7",
69
+ "@otwb/app": "^2.0.2"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@otwb/page": ">=4.0",