@otwb/ui 2.0.23 → 2.0.25

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.
@@ -333,6 +333,7 @@ var DataCustomItem = /* @__PURE__ */ defineComponent({
333
333
  wrap: !1,
334
334
  size: "small"
335
335
  }, { default: () => [
336
+ e.showFixed,
336
337
  createVNode(NButton, {
337
338
  type: "primary",
338
339
  text: !0,
@@ -399,17 +400,32 @@ const DataCustom = /* @__PURE__ */ defineComponent({
399
400
  },
400
401
  type: { type: String }
401
402
  },
402
- emits: { custom: () => !0 },
403
+ emits: {
404
+ custom: () => !0,
405
+ save: ""
406
+ },
403
407
  setup(x, { emit: S }) {
404
- let { t: C } = useI18n();
405
- function w(e, b, C) {
408
+ let { t: C } = useI18n(), w = useRoute();
409
+ function T() {
410
+ if (x.showFixed) {
411
+ w.name + "";
412
+ let e = w.name + "__table";
413
+ $fetch.post(`${SERVER_CTX.SYS}/cli/module/custom-config/save`, {
414
+ __table: localStorage.getItem(e),
415
+ url: w.name
416
+ }, { requestType: "json" }).then((e) => {
417
+ $msg.success("配置保存成功!");
418
+ });
419
+ } else S("save");
420
+ }
421
+ function E(e, b, C) {
406
422
  S("custom", {
407
423
  key: e[x.keyField],
408
424
  [b]: C
409
425
  });
410
426
  }
411
- let T = ref();
412
- return watch(T, (e) => {
427
+ let D = ref();
428
+ return watch(D, (e) => {
413
429
  e.$el && Sortable.create(e.$el, {
414
430
  animation: 150,
415
431
  ghostClass: "ghost",
@@ -436,13 +452,19 @@ const DataCustom = /* @__PURE__ */ defineComponent({
436
452
  }, { default: () => [createVNode(IFilterCustom, null, null)] })] }), [[vTooltip, x.tooltip ?? C("common.page.custom.tooltip")]]),
437
453
  default: () => {
438
454
  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, {
455
+ 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, {
456
+ class: "mr-10px",
457
+ text: !0,
458
+ type: "primary",
459
+ size: "small",
460
+ onClick: () => T()
461
+ }, { default: () => [createTextVNode("保存")] }), createVNode(NButton, {
440
462
  text: !0,
441
463
  type: "primary",
442
464
  size: "small",
443
465
  onClick: () => S("custom", !0)
444
- }, _isSlot$6(e = C("common.page.custom.reset")) ? e : { default: () => [e] })] }), createVNode(NFlex, {
445
- ref: T,
466
+ }, _isSlot$6(e = C("common.page.custom.reset")) ? e : { default: () => [e] })])] }), createVNode(NFlex, {
467
+ ref: D,
446
468
  vertical: !0
447
469
  }, _isSlot$6(b = x.data.filter((e) => e[x.visiblityField] !== !1).map((e) => createVNode(DataCustomItem, {
448
470
  key: e[x.keyField],
@@ -450,8 +472,8 @@ const DataCustom = /* @__PURE__ */ defineComponent({
450
472
  hidden: e[x.hiddenField],
451
473
  fixed: e[x.fixedField],
452
474
  showFixed: x.showFixed,
453
- onUpdateHidden: (b) => w(e, "hidden", b),
454
- onUpdateFixed: (b) => w(e, "fixed", b)
475
+ onUpdateHidden: (b) => E(e, "hidden", b),
476
+ onUpdateFixed: (b) => E(e, "fixed", b)
455
477
  }, null))) ? b : { default: () => [b] })] });
456
478
  }
457
479
  });
@@ -727,59 +749,69 @@ const DataForm = /* @__PURE__ */ defineComponent({
727
749
  "collapse"
728
750
  ],
729
751
  setup(b, { expose: x, emit: S }) {
730
- let { t: C } = useI18n(), w = (e) => {
752
+ let C = useRoute(), w = () => {
753
+ let e = C.name + "__form";
754
+ C.name + "", $fetch.post(`${SERVER_CTX.SYS}/cli/module/custom-config/save`, {
755
+ __form: localStorage.getItem(e),
756
+ url: C.name
757
+ }, { requestType: "json" }).then((e) => {
758
+ $msg.success("配置保存成功!");
759
+ });
760
+ }, { t: T } = useI18n(), E = (e) => {
731
761
  S("filter", b.model, e);
732
- }, T = (e) => {
762
+ }, D = (e) => {
733
763
  S("reset", e), b.filterOnReset && S("filter", b.model, e);
734
- }, E = ref(b.defaultCollapsed), D = (e) => {
735
- E.value = e;
764
+ }, k = ref(b.defaultCollapsed), A = (e) => {
765
+ k.value = e;
736
766
  };
737
- x({ collapse: D });
738
- let k = reactive({
767
+ x({ collapse: A });
768
+ let j = reactive({
739
769
  span: 6,
740
770
  suffix: !0
741
771
  });
742
772
  return () => {
743
- let { filterOnReset: e, filterText: x, resetText: A, customizable: j, defaultCollapsed: N, collapsible: P, grid: F,...I } = b;
773
+ let { filterOnReset: e, filterText: x, resetText: C, customizable: N, defaultCollapsed: P, collapsible: F, grid: I,...L } = b;
744
774
  return createVNode(DataForm, mergeProps({ grid: {
745
775
  cols: "12 768:18 1200:30 1536:30",
746
776
  yGap: 16,
747
777
  xGap: 12,
748
- ...F,
749
- collapsed: E.value
750
- } }, I, {
778
+ ...I,
779
+ collapsed: k.value
780
+ } }, L, {
751
781
  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",
782
+ showAction: j,
783
+ onSubmit: E,
784
+ onReset: D
785
+ }), { action: ({ cols: e, spans: E }) => (j.suffix = e < E + j.span, createVNode(NFlex, {
786
+ justify: j.suffix ? "end" : "start",
757
787
  align: "center"
758
788
  }, { default: () => [
759
- P && k.suffix ? createVNode(NButton, {
789
+ F && j.suffix ? createVNode(NButton, {
760
790
  class: "collapsedBtn",
761
791
  text: !0,
762
792
  type: "primary",
763
793
  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")]),
794
+ renderIcon: k.value ? IDown : IUp,
795
+ onClick: () => A(!k.value)
796
+ }, { default: () => [k.value ? T("common.page.filter.expand") : T("common.page.filter.collapse")] }) : void 0,
797
+ j.suffix ? void 0 : createVNode("span", null, [createTextVNode("\xA0\xA0\xA0\xA0")]),
768
798
  createVNode(NButton, {
769
799
  class: "submitWrap",
770
800
  attrType: "submit",
771
801
  type: "primary",
772
802
  disabled: b.disabled,
773
803
  loading: b.loading
774
- }, { default: () => [x || C("common.page.filter.submitText")] }),
804
+ }, { default: () => [x || T("common.page.filter.submitText")] }),
775
805
  createVNode(NButton, {
776
806
  attrType: "reset",
777
807
  disabled: b.disabled || b.loading
778
- }, { default: () => [A || C("common.page.form.resetText")] }),
779
- j ? createVNode(DataCustom, {
808
+ }, { default: () => [C || T("common.page.form.resetText")] }),
809
+ N ? createVNode(DataCustom, {
810
+ isFilter: !0,
780
811
  keyField: "name",
781
812
  showFixed: !1,
782
- data: I.items,
813
+ data: L.items,
814
+ onSave: w,
783
815
  onCustom: (e) => S("custom", e),
784
816
  size: 16,
785
817
  type: "primary"
@@ -902,19 +934,27 @@ const DataLocaleInput = /* @__PURE__ */ defineComponent({
902
934
  },
903
935
  emits: { change: () => !0 },
904
936
  setup(b, { emit: x }) {
905
- let { t: S } = useI18n(), C = (e) => x("change", {
937
+ let { t: S } = useI18n(), C = useRoute(), w = (e) => x("change", {
906
938
  pageSize: b.pageSize ?? b.page?.pageSize ?? 0,
907
939
  currentPage: e
908
- }), w = (e) => x("change", {
909
- pageSize: e,
910
- currentPage: b.currentPage ?? b.page?.currentPage ?? 0
911
- });
912
- return () => createVNode(NPagination, {
940
+ }), T = (e) => {
941
+ let S = C.name + "__page";
942
+ $fetch.post(`${SERVER_CTX.SYS}/cli/module/custom-config/save`, {
943
+ __page: e,
944
+ url: C.name
945
+ }, { requestType: "json" }).then((b) => {
946
+ localStorage.setItem(S, e);
947
+ }), x("change", {
948
+ pageSize: e,
949
+ currentPage: b.currentPage ?? b.page?.currentPage ?? 0
950
+ });
951
+ }, E = C.name + "__page";
952
+ return localStorage.getItem(E) && (b.page.pageSize = localStorage.getItem(E)), () => createVNode(NPagination, {
913
953
  page: b.currentPage ?? b.page?.currentPage,
914
954
  itemCount: b.total,
915
955
  pageSize: b.pageSize ?? b.page?.pageSize,
916
- onUpdatePage: C,
917
- onUpdatePageSize: w,
956
+ onUpdatePage: w,
957
+ onUpdatePageSize: T,
918
958
  pageSizes: b.pageSizes,
919
959
  showQuickJumper: !0,
920
960
  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-BMteXZVn.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
@@ -3,7 +3,7 @@ import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDire
3
3
  import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-DcT-1dj4.js";
4
4
  import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, provide, reactive, ref, renderSlot, shallowRef, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
5
5
  import { computedAsync, promiseTimeout, useElementHover, useElementSize, useEventListener, useFullscreen, watchDebounced } from "@vueuse/core";
6
- import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NTabPane, NTabs, NText, NThing, useThemeVars } from "ithinkdt-ui";
6
+ import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NTabPane, NTabs, NText, NThing, NTooltip, useThemeVars } from "ithinkdt-ui";
7
7
  import { useAtomicBroadcast } from "@otwb/common/composables";
8
8
  import { RouterLink, useRouter } from "vue-router";
9
9
  import { walkTree } from "@otwb/common/tree";
@@ -550,6 +550,9 @@ const AppMenu = /* @__PURE__ */ defineComponent({
550
550
  },
551
551
  setup(d) {
552
552
  let z = shallowRef([]);
553
+ function V(d, z) {
554
+ return d.length > 7;
555
+ }
553
556
  watch([() => d.menus, () => d.single], ([B, V]) => {
554
557
  if (z.value = [], !B?.length) return;
555
558
  let H = (z, B = 0) => {
@@ -573,19 +576,44 @@ const AppMenu = /* @__PURE__ */ defineComponent({
573
576
  }, { immediate: !0 }), watch([useTemplateRef("menu"), () => d.current], ([d, z]) => {
574
577
  d?.showOption(z);
575
578
  }, { immediate: !0 });
576
- let V = inject(COLLAPSED_INJECTION_KEY, !1), H = (z) => {
577
- let H = d.collapsed ?? unref(V), U;
578
- if (z._.type === "view") if (z.isExternal && z.externalEmbed) U = createVNode("a", {
579
+ let H = inject(COLLAPSED_INJECTION_KEY, !1), U = (z) => {
580
+ let U = d.collapsed ?? unref(H), W;
581
+ if (z._.type === "view") if (z.isExternal && z.externalEmbed) W = createVNode("a", {
579
582
  href: z.externalLink,
580
583
  target: "_blank",
581
584
  onClick: (d) => d.stopPropagation()
582
585
  }, [z.label()]);
583
- else {
586
+ else if (U) {
584
587
  let d;
585
- U = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] });
588
+ W = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] });
589
+ } else {
590
+ let d, B = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] }), H = createVNode("span", null, [z.label()]);
591
+ W = createVNode(NTooltip, {
592
+ placement: "top",
593
+ trigger: "hover",
594
+ showArrow: !0,
595
+ delay: 300,
596
+ disabled: !V(z.label(), z)
597
+ }, {
598
+ default: () => H,
599
+ trigger: () => B
600
+ });
586
601
  }
587
- else U = createVNode("span", null, [z.label()]);
588
- return U.key = `${z.key}:${H ? 1 : 0}`, z.depth === 0 && !H && (U = withDirectives(U, [[
602
+ else if (U) W = createVNode("span", null, [z.label()]);
603
+ else {
604
+ let d = createVNode("span", null, [z.label()]);
605
+ W = createVNode(NTooltip, {
606
+ placement: "top",
607
+ trigger: "hover",
608
+ showArrow: !0,
609
+ delay: 300,
610
+ disabled: !V(z.label(), z)
611
+ }, {
612
+ default: () => d,
613
+ trigger: () => d
614
+ });
615
+ }
616
+ return W.key = `${z.key}:${U ? 1 : 0}`, z.depth === 0 && !U && (W = withDirectives(W, [[
589
617
  vTooltip,
590
618
  z.label(),
591
619
  void 0,
@@ -593,7 +621,7 @@ const AppMenu = /* @__PURE__ */ defineComponent({
593
621
  auto: !0,
594
622
  right: !0
595
623
  }
596
- ]])), z.isNew && (U = createVNode("div", { style: "display: flex; width: 100%" }, [createVNode("span", { style: "flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis" }, [U]), createVNode("svg", {
624
+ ]])), z.isNew && (W = createVNode("div", { style: "display: flex; width: 100%" }, [createVNode("span", { style: "flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis" }, [W]), createVNode("svg", {
597
625
  xmlns: "http://www.w3.org/2000/svg",
598
626
  width: "24",
599
627
  height: "24",
@@ -602,7 +630,7 @@ const AppMenu = /* @__PURE__ */ defineComponent({
602
630
  }, [createVNode("path", {
603
631
  d: "M245.76 286.72h552.96c124.928 0 225.28 100.352 225.28 225.28s-100.352 225.28-225.28 225.28H0V532.48c0-135.168 110.592-245.76 245.76-245.76z m133.12 348.16V401.408H348.16v178.176l-112.64-178.176H204.8V634.88h30.72v-178.176L348.16 634.88h30.72z m182.272-108.544v-24.576h-96.256v-75.776h110.592v-24.576h-141.312V634.88h143.36v-24.576h-112.64v-83.968h96.256z m100.352 28.672l-34.816-151.552h-34.816l55.296 233.472H675.84l47.104-161.792 4.096-20.48 4.096 20.48 47.104 161.792h28.672l57.344-233.472h-34.816l-32.768 151.552-4.096 30.72-6.144-30.72-40.96-151.552h-30.72l-40.96 151.552-6.144 30.72-6.144-30.72z",
604
632
  fill: "var(--color-danger)"
605
- }, null)])])), U;
633
+ }, null)])])), W;
606
634
  };
607
635
  return () => {
608
636
  let B = createVNode(NMenu, {
@@ -610,11 +638,11 @@ const AppMenu = /* @__PURE__ */ defineComponent({
610
638
  options: z.value,
611
639
  rootIndent: 16,
612
640
  accordion: d.accordion,
613
- collapsed: d.collapsed ?? unref(V),
641
+ collapsed: d.collapsed ?? unref(H),
614
642
  dropdownProps: { showArrow: !0 },
615
643
  mode: d.horizontal ? "horizontal" : "vertical",
616
644
  value: d.current ?? null,
617
- renderLabel: H,
645
+ renderLabel: U,
618
646
  responsive: !0,
619
647
  collapsedWidth: d.collapsedWidth,
620
648
  width: d.width
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-BMteXZVn.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.23",
3
+ "version": "2.0.25",
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",