@otwb/ui 2.0.24 → 2.0.26

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.
@@ -4,6 +4,7 @@ import { g as useStyle, h as useMergedClsPrefix, n as cB, r as cE, t as c } from
4
4
  import { Fragment, computed, createTextVNode, createVNode, defineComponent, inject, isVNode, mergeProps, nextTick, reactive, ref, shallowRef, toRaw, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
5
5
  import { toReactive, unrefElement, until, useCurrentElement, useElementSize, watchDebounced } from "@vueuse/core";
6
6
  import { NAvatar, NAvatarGroup, NButton, NCard, NCheckbox, NCheckboxGroup, NDataTable, NDropdown, NEllipsis, NEmpty, NFlex, NForm, NFormItem, NGi, NGrid, NH4, NIcon, NInput, NList, NListItem, NPagination, NPerformantEllipsis, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpin, NTag, NText, NTooltip, NTransfer, NTree, NTreeSelect, dataTableProps, formProps, useDialog } from "ithinkdt-ui";
7
+ import { useRoute as useRoute$1 } from "vue-router";
7
8
  import { VOverflow, VResizeObserver } from "vueuc";
8
9
  import { Sortable } from "sortablejs/modular/sortable.core.esm.js";
9
10
  import { pickProps } from "@otwb/common/object";
@@ -333,6 +334,7 @@ var DataCustomItem = /* @__PURE__ */ defineComponent({
333
334
  wrap: !1,
334
335
  size: "small"
335
336
  }, { default: () => [
337
+ e.showFixed,
336
338
  createVNode(NButton, {
337
339
  type: "primary",
338
340
  text: !0,
@@ -399,17 +401,32 @@ const DataCustom = /* @__PURE__ */ defineComponent({
399
401
  },
400
402
  type: { type: String }
401
403
  },
402
- emits: { custom: () => !0 },
404
+ emits: {
405
+ custom: () => !0,
406
+ save: ""
407
+ },
403
408
  setup(x, { emit: S }) {
404
- let { t: C } = useI18n();
405
- function w(e, b, C) {
409
+ let { t: C } = useI18n(), w = useRoute$1();
410
+ function T() {
411
+ if (x.showFixed) {
412
+ w.name + "";
413
+ let e = w.name + "__table";
414
+ $fetch.post(`${SERVER_CTX.SYS}/cli/module/custom-config/save`, {
415
+ __table: localStorage.getItem(e),
416
+ url: w.name
417
+ }, { requestType: "json" }).then((e) => {
418
+ $msg.success("配置保存成功!");
419
+ });
420
+ } else S("save");
421
+ }
422
+ function E(e, b, C) {
406
423
  S("custom", {
407
424
  key: e[x.keyField],
408
425
  [b]: C
409
426
  });
410
427
  }
411
- let T = ref();
412
- return watch(T, (e) => {
428
+ let D = ref();
429
+ return watch(D, (e) => {
413
430
  e.$el && Sortable.create(e.$el, {
414
431
  animation: 150,
415
432
  ghostClass: "ghost",
@@ -436,13 +453,19 @@ const DataCustom = /* @__PURE__ */ defineComponent({
436
453
  }, { default: () => [createVNode(IFilterCustom, null, null)] })] }), [[vTooltip, x.tooltip ?? C("common.page.custom.tooltip")]]),
437
454
  default: () => {
438
455
  let e, b;
439
- return createVNode(NFlex, { vertical: !0 }, { default: () => [createVNode(NFlex, { justify: "space-between" }, { default: () => [createVNode("div", { style: "font-weight: bold" }, [x.tooltip ?? C("common.page.custom.tooltip")]), createVNode(NButton, {
456
+ return createVNode(NFlex, { vertical: !0 }, { default: () => [createVNode(NFlex, { justify: "space-between" }, { default: () => [createVNode("div", { style: "font-weight: bold" }, [x.tooltip ?? C("common.page.custom.tooltip")]), createVNode("div", null, [createVNode(NButton, {
457
+ class: "mr-10px",
458
+ text: !0,
459
+ type: "primary",
460
+ size: "small",
461
+ onClick: () => T()
462
+ }, { default: () => [createTextVNode("保存")] }), createVNode(NButton, {
440
463
  text: !0,
441
464
  type: "primary",
442
465
  size: "small",
443
466
  onClick: () => S("custom", !0)
444
- }, _isSlot$6(e = C("common.page.custom.reset")) ? e : { default: () => [e] })] }), createVNode(NFlex, {
445
- ref: T,
467
+ }, _isSlot$6(e = C("common.page.custom.reset")) ? e : { default: () => [e] })])] }), createVNode(NFlex, {
468
+ ref: D,
446
469
  vertical: !0
447
470
  }, _isSlot$6(b = x.data.filter((e) => e[x.visiblityField] !== !1).map((e) => createVNode(DataCustomItem, {
448
471
  key: e[x.keyField],
@@ -450,8 +473,8 @@ const DataCustom = /* @__PURE__ */ defineComponent({
450
473
  hidden: e[x.hiddenField],
451
474
  fixed: e[x.fixedField],
452
475
  showFixed: x.showFixed,
453
- onUpdateHidden: (b) => w(e, "hidden", b),
454
- onUpdateFixed: (b) => w(e, "fixed", b)
476
+ onUpdateHidden: (b) => E(e, "hidden", b),
477
+ onUpdateFixed: (b) => E(e, "fixed", b)
455
478
  }, null))) ? b : { default: () => [b] })] });
456
479
  }
457
480
  });
@@ -727,59 +750,69 @@ const DataForm = /* @__PURE__ */ defineComponent({
727
750
  "collapse"
728
751
  ],
729
752
  setup(b, { expose: x, emit: S }) {
730
- let { t: C } = useI18n(), w = (e) => {
753
+ let C = useRoute$1(), w = () => {
754
+ let e = C.name + "__form";
755
+ C.name + "", $fetch.post(`${SERVER_CTX.SYS}/cli/module/custom-config/save`, {
756
+ __form: localStorage.getItem(e),
757
+ url: C.name
758
+ }, { requestType: "json" }).then((e) => {
759
+ $msg.success("配置保存成功!");
760
+ });
761
+ }, { t: T } = useI18n(), E = (e) => {
731
762
  S("filter", b.model, e);
732
- }, T = (e) => {
763
+ }, D = (e) => {
733
764
  S("reset", e), b.filterOnReset && S("filter", b.model, e);
734
- }, E = ref(b.defaultCollapsed), D = (e) => {
735
- E.value = e;
765
+ }, k = ref(b.defaultCollapsed), A = (e) => {
766
+ k.value = e;
736
767
  };
737
- x({ collapse: D });
738
- let k = reactive({
768
+ x({ collapse: A });
769
+ let j = reactive({
739
770
  span: 6,
740
771
  suffix: !0
741
772
  });
742
773
  return () => {
743
- let { filterOnReset: e, filterText: x, resetText: A, customizable: j, defaultCollapsed: N, collapsible: P, grid: F,...I } = b;
774
+ let { filterOnReset: e, filterText: x, resetText: C, customizable: N, defaultCollapsed: P, collapsible: F, grid: I,...L } = b;
744
775
  return createVNode(DataForm, mergeProps({ grid: {
745
776
  cols: "12 768:18 1200:30 1536:30",
746
777
  yGap: 16,
747
778
  xGap: 12,
748
- ...F,
749
- collapsed: E.value
750
- } }, I, {
779
+ ...I,
780
+ collapsed: k.value
781
+ } }, L, {
751
782
  showFeedback: !1,
752
- showAction: k,
753
- onSubmit: w,
754
- onReset: T
755
- }), { action: ({ cols: e, spans: w }) => (k.suffix = e < w + k.span, createVNode(NFlex, {
756
- justify: k.suffix ? "end" : "start",
783
+ showAction: j,
784
+ onSubmit: E,
785
+ onReset: D
786
+ }), { action: ({ cols: e, spans: E }) => (j.suffix = e < E + j.span, createVNode(NFlex, {
787
+ justify: j.suffix ? "end" : "start",
757
788
  align: "center"
758
789
  }, { default: () => [
759
- P && k.suffix ? createVNode(NButton, {
790
+ F && j.suffix ? createVNode(NButton, {
760
791
  class: "collapsedBtn",
761
792
  text: !0,
762
793
  type: "primary",
763
794
  iconPlacement: "right",
764
- renderIcon: E.value ? IDown : IUp,
765
- onClick: () => D(!E.value)
766
- }, { default: () => [E.value ? C("common.page.filter.expand") : C("common.page.filter.collapse")] }) : void 0,
767
- k.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
795
+ renderIcon: k.value ? IDown : IUp,
796
+ onClick: () => A(!k.value)
797
+ }, { default: () => [k.value ? T("common.page.filter.expand") : T("common.page.filter.collapse")] }) : void 0,
798
+ j.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
768
799
  createVNode(NButton, {
769
800
  class: "submitWrap",
770
801
  attrType: "submit",
771
802
  type: "primary",
772
803
  disabled: b.disabled,
773
804
  loading: b.loading
774
- }, { default: () => [x || C("common.page.filter.submitText")] }),
805
+ }, { default: () => [x || T("common.page.filter.submitText")] }),
775
806
  createVNode(NButton, {
776
807
  attrType: "reset",
777
808
  disabled: b.disabled || b.loading
778
- }, { default: () => [A || C("common.page.form.resetText")] }),
779
- j ? createVNode(DataCustom, {
809
+ }, { default: () => [C || T("common.page.form.resetText")] }),
810
+ N ? createVNode(DataCustom, {
811
+ isFilter: !0,
780
812
  keyField: "name",
781
813
  showFixed: !1,
782
- data: I.items,
814
+ data: L.items,
815
+ onSave: w,
783
816
  onCustom: (e) => S("custom", e),
784
817
  size: 16,
785
818
  type: "primary"
@@ -902,19 +935,27 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
902
935
  },
903
936
  emits: { change: () => !0 },
904
937
  setup(b, { emit: x }) {
905
- let { t: S } = useI18n(), C = (e) => x("change", {
938
+ let { t: S } = useI18n(), C = useRoute(), w = (e) => x("change", {
906
939
  pageSize: b.pageSize ?? b.page?.pageSize ?? 0,
907
940
  currentPage: e
908
- }), w = (e) => x("change", {
909
- pageSize: e,
910
- currentPage: b.currentPage ?? b.page?.currentPage ?? 0
911
- });
912
- return () => createVNode(NPagination, {
941
+ }), T = (e) => {
942
+ let S = C.name + "__page";
943
+ $fetch.post(`${SERVER_CTX.SYS}/cli/module/custom-config/save`, {
944
+ __page: e,
945
+ url: C.name
946
+ }, { requestType: "json" }).then((b) => {
947
+ localStorage.setItem(S, e);
948
+ }), x("change", {
949
+ pageSize: e,
950
+ currentPage: b.currentPage ?? b.page?.currentPage ?? 0
951
+ });
952
+ }, E = C.name + "__page";
953
+ return localStorage.getItem(E) && (b.page.pageSize = localStorage.getItem(E)), () => createVNode(NPagination, {
913
954
  page: b.currentPage ?? b.page?.currentPage,
914
955
  itemCount: b.total,
915
956
  pageSize: b.pageSize ?? b.page?.pageSize,
916
- onUpdatePage: C,
917
- onUpdatePageSize: w,
957
+ onUpdatePage: w,
958
+ onUpdatePageSize: T,
918
959
  pageSizes: b.pageSizes,
919
960
  showQuickJumper: !0,
920
961
  showSizePicker: !0,
@@ -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-C3FvQCdL.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-C6Mef5JA.js";
5
5
  export { DataActions, DataCustom, DataFilter, DataForm, DataLocaleInput, DataPagination, DataSelection, DataTable, DtDeptRender, DtUserDept, DtUserRender, NCheckboxes, NRadios, renderUsers, useDataTableDrag, useLocaleEdit };
package/dist/index.js CHANGED
@@ -583,7 +583,10 @@ const AppMenu = /* @__PURE__ */ defineComponent({
583
583
  target: "_blank",
584
584
  onClick: (d) => d.stopPropagation()
585
585
  }, [z.label()]);
586
- else {
586
+ else if (U) {
587
+ let d;
588
+ W = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] });
589
+ } else {
587
590
  let d, B = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] }), H = createVNode("span", null, [z.label()]);
588
591
  W = createVNode(NTooltip, {
589
592
  placement: "top",
@@ -596,6 +599,7 @@ const AppMenu = /* @__PURE__ */ defineComponent({
596
599
  trigger: () => B
597
600
  });
598
601
  }
602
+ else if (U) W = createVNode("span", null, [z.label()]);
599
603
  else {
600
604
  let d = createVNode("span", null, [z.label()]);
601
605
  W = createVNode(NTooltip, {
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-C3FvQCdL.js";
4
+ import { a as NRadios, g as NCheckboxes, n as DtUserDept, p as DataForm, r as DtUserRender, t as DtDeptRender } from "./components-C6Mef5JA.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.24",
3
+ "version": "2.0.26",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "otwb UI",
@@ -90,7 +90,7 @@
90
90
  "vite": "npm:rolldown-vite@^7.1.20",
91
91
  "vue": "^3.5.22",
92
92
  "vue-router": "^4.6.3",
93
- "@otwb/page": "^2.0.2"
93
+ "@otwb/page": "^2.0.5"
94
94
  },
95
95
  "scripts": {
96
96
  "dev": "vite build --watch",