@wujies/components 5.6.4 → 5.6.6

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 (40) hide show
  1. package/dist/components/KCustomTabs.vue.d.ts +27 -0
  2. package/dist/components/KIpSegmentInput.vue.d.ts +16 -0
  3. package/dist/components/KPagination.vue.d.ts +136 -0
  4. package/dist/components/KRightToolbar.vue.d.ts +48 -0
  5. package/dist/components/KSectionTitle.vue.d.ts +15 -0
  6. package/dist/components/KSegmented.vue.d.ts +61 -0
  7. package/dist/components/KSpin.vue.d.ts +27 -0
  8. package/dist/components/KTableSiderLayout.vue.d.ts +30 -0
  9. package/dist/index.d.ts +37 -18
  10. package/dist/index.js +1128 -1600
  11. package/dist/index.js.map +1 -1
  12. package/dist/names.d.ts +15 -5
  13. package/dist/names.js +21 -3
  14. package/dist/names.js.map +1 -1
  15. package/dist/propTypes.d.ts +24 -0
  16. package/dist/style.css +448 -288
  17. package/dist/types.d.ts +11 -0
  18. package/dist/utils/scroll-to.d.ts +6 -0
  19. package/package.json +6 -6
  20. package/dist/host/api/config.d.ts +0 -2
  21. package/dist/host/api/oss.d.ts +0 -2
  22. package/dist/host/api/types.d.ts +0 -11
  23. package/dist/host/api/user.d.ts +0 -1
  24. package/dist/host/components/ImageUpload.vue.d.ts +0 -129
  25. package/dist/host/components/ModuleBusinessSettings.vue.d.ts +0 -7
  26. package/dist/host/components/ModuleWebsiteSettings.vue.d.ts +0 -7
  27. package/dist/host/components/UserDetail.vue.d.ts +0 -10
  28. package/dist/host/contact.d.ts +0 -5
  29. package/dist/host/propTypes.d.ts +0 -29
  30. package/dist/host/request.d.ts +0 -4
  31. package/dist/{host/components → components}/ImagePreview.vue.d.ts +0 -0
  32. package/dist/{host/components → components}/KCard.vue.d.ts +0 -0
  33. package/dist/{host/components → components}/KDictTag.vue.d.ts +0 -0
  34. package/dist/{host/components → components}/KPlainButton.vue.d.ts +0 -0
  35. package/dist/{host/components → components}/KSearchBar.vue.d.ts +2 -2
  36. package/dist/{host/components → components}/KSelectedAlert.vue.d.ts +0 -0
  37. package/dist/{host/components → components}/KTable.vue.d.ts +1 -1
  38. /package/dist/{host/components → components}/KTableHeader.vue.d.ts +0 -0
  39. /package/dist/{host/components → components}/SettingForm.vue.d.ts +0 -0
  40. /package/dist/{host/components → components}/SettingTabs.vue.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,8 +1,7 @@
1
- import { defineComponent, ref, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, withCtx, createElementVNode, createVNode, getCurrentInstance, watch, createElementBlock, normalizeClass, isRef, createCommentVNode, toDisplayString, mergeProps, createSlots, renderSlot, Fragment, renderList, createTextVNode, resolveDynamicComponent, useModel, useTemplateRef, mergeModels, useAttrs, resolveDirective, withDirectives, toRefs, reactive, h as h$1, onMounted, nextTick, onUnmounted, onBeforeUnmount } from "vue";
2
- import { Plus, ZoomIn, Delete, QuestionFilled, Refresh, Search, FullScreen, Rank, Back, Right, Operation, Menu, User } from "@element-plus/icons-vue";
3
- import { request, globalHeaders as globalHeaders$1 } from "@wujies/ui-shared";
1
+ import { defineComponent, ref, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, withCtx, createElementVNode, createVNode, mergeProps, createSlots, renderSlot, createElementBlock, isRef, Fragment, renderList, resolveDynamicComponent, toDisplayString, normalizeClass, createTextVNode, createCommentVNode, reactive, watch, withDirectives, vModelText, useCssVars, onMounted, useModel, useTemplateRef, mergeModels, Transition, useAttrs, resolveDirective, toRefs, h as h$1, getCurrentInstance, nextTick, onUnmounted, onBeforeUnmount, hasInjectionContext, inject, getCurrentScope, onScopeDispose, shallowRef, toValue, watchEffect, withModifiers, vShow } from "vue";
2
+ import { Refresh, Search, Loading, FullScreen, Rank, Back, Right, Operation, Menu, ArrowRight, ArrowLeft } from "@element-plus/icons-vue";
4
3
  import { ElForm, ElOption, ElCheckbox, ElRadio, ElTreeSelect, ElTimeSelect, ElTimePicker, ElCascader, ElDatePicker, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElSelect, ElInputNumber, ElInput } from "element-plus";
5
- import { WUJIES_COMPONENT_NAMES } from "./names.js";
4
+ import { WUJIES_COMPONENT_NAMES, WUJIES_HOST_ONLY_COMPONENT_NAMES } from "./names.js";
6
5
  const config = {
7
6
  silent: false,
8
7
  logLevel: "warn"
@@ -24,7 +23,7 @@ const typeDefaults = () => ({
24
23
  integer: 0
25
24
  });
26
25
  const ObjProto = Object.prototype;
27
- const toString = ObjProto.toString;
26
+ const toString$1 = ObjProto.toString;
28
27
  const hasOwn = ObjProto.hasOwnProperty;
29
28
  const FN_MATCH_REGEXP = /^\s*function (\w+)/;
30
29
  function getType(fn) {
@@ -69,9 +68,9 @@ const isInteger = Number.isInteger || function isInteger2(value) {
69
68
  return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
70
69
  };
71
70
  const isArray = Array.isArray || function isArray2(value) {
72
- return toString.call(value) === "[object Array]";
71
+ return toString$1.call(value) === "[object Array]";
73
72
  };
74
- const isFunction = (value) => toString.call(value) === "[object Function]";
73
+ const isFunction = (value) => toString$1.call(value) === "[object Function]";
75
74
  const isVueTypeDef = (value, name) => isPlainObject(value) && has(value, "_vueTypes_name") && (!name || value._vueTypes_name === name);
76
75
  const isComplexType = (value) => isPlainObject(value) && (has(value, "type") || ["_vueTypes_name", "validator", "default", "required"].some(
77
76
  (k) => has(value, k)
@@ -554,8 +553,8 @@ function createTypes(defs = typeDefaults()) {
554
553
  class VueTypes extends createTypes() {
555
554
  }
556
555
  const propTypes = VueTypes;
557
- const _hoisted_1$b = { class: "image-slot" };
558
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
556
+ const _hoisted_1$d = { class: "image-slot" };
557
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
559
558
  __name: "ImagePreview",
560
559
  props: {
561
560
  src: propTypes.string.def(""),
@@ -724,7 +723,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
724
723
  }, 1032, ["onClick"])
725
724
  ]),
726
725
  error: withCtx(() => [
727
- createElementVNode("div", _hoisted_1$b, [
726
+ createElementVNode("div", _hoisted_1$d, [
728
727
  createVNode(_component_el_icon, null, {
729
728
  default: withCtx(() => [
730
729
  createVNode(_component_picture_filled)
@@ -745,655 +744,8 @@ const _export_sfc = (sfc, props) => {
745
744
  }
746
745
  return target;
747
746
  };
748
- const ImagePreview = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-ed5d331b"]]);
749
- const globalHeaders = globalHeaders$1;
750
- function getBaseUrl() {
751
- var _a;
752
- return String(((_a = request.defaults) == null ? void 0 : _a.baseURL) ?? "");
753
- }
754
- function listByIds(ossId) {
755
- return request({
756
- url: "/resource/oss/listByIds/" + ossId,
757
- method: "get"
758
- });
759
- }
760
- function delOss(ossId) {
761
- return request({
762
- url: "/resource/oss/" + ossId,
763
- method: "delete"
764
- });
765
- }
766
- const oss = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
767
- __proto__: null,
768
- delOss,
769
- listByIds
770
- }, Symbol.toStringTag, { value: "Module" }));
771
- var conversion$1 = { exports: {} };
772
- var conversion = conversion$1.exports;
773
- var hasRequiredConversion;
774
- function requireConversion() {
775
- if (hasRequiredConversion) return conversion$1.exports;
776
- hasRequiredConversion = 1;
777
- (function(module, exports) {
778
- !(function(t, e) {
779
- module.exports = e();
780
- })(conversion, (function() {
781
- return (function(t) {
782
- var e = {};
783
- function n(r) {
784
- if (e[r]) return e[r].exports;
785
- var o = e[r] = { i: r, l: false, exports: {} };
786
- return t[r].call(o.exports, o, o.exports, n), o.l = true, o.exports;
787
- }
788
- return n.m = t, n.c = e, n.d = function(t2, e2, r) {
789
- n.o(t2, e2) || Object.defineProperty(t2, e2, { enumerable: true, get: r });
790
- }, n.r = function(t2) {
791
- "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true });
792
- }, n.t = function(t2, e2) {
793
- if (1 & e2 && (t2 = n(t2)), 8 & e2) return t2;
794
- if (4 & e2 && "object" == typeof t2 && t2 && t2.__esModule) return t2;
795
- var r = /* @__PURE__ */ Object.create(null);
796
- if (n.r(r), Object.defineProperty(r, "default", { enumerable: true, value: t2 }), 2 & e2 && "string" != typeof t2) for (var o in t2) n.d(r, o, (function(e3) {
797
- return t2[e3];
798
- }).bind(null, o));
799
- return r;
800
- }, n.n = function(t2) {
801
- var e2 = t2 && t2.__esModule ? function() {
802
- return t2.default;
803
- } : function() {
804
- return t2;
805
- };
806
- return n.d(e2, "a", e2), e2;
807
- }, n.o = function(t2, e2) {
808
- return Object.prototype.hasOwnProperty.call(t2, e2);
809
- }, n.p = "", n(n.s = 0);
810
- })([function(t, e, n) {
811
- var r;
812
- function o(t2) {
813
- return ["image/png", "image/jpeg", "image/gif"].some((e2) => e2 === t2);
814
- }
815
- n.r(e), n.d(e, "canvastoDataURL", (function() {
816
- return a;
817
- })), n.d(e, "canvastoFile", (function() {
818
- return c2;
819
- })), n.d(e, "dataURLtoFile", (function() {
820
- return s;
821
- })), n.d(e, "dataURLtoImage", (function() {
822
- return l;
823
- })), n.d(e, "downloadFile", (function() {
824
- return d;
825
- })), n.d(e, "filetoDataURL", (function() {
826
- return f;
827
- })), n.d(e, "imagetoCanvas", (function() {
828
- return g2;
829
- })), n.d(e, "urltoBlob", (function() {
830
- return w;
831
- })), n.d(e, "urltoImage", (function() {
832
- return m;
833
- })), n.d(e, "compress", (function() {
834
- return p2;
835
- })), n.d(e, "compressAccurately", (function() {
836
- return b;
837
- })), n.d(e, "EImageType", (function() {
838
- return r;
839
- })), (function(t2) {
840
- t2.PNG = "image/png", t2.JPEG = "image/jpeg", t2.GIF = "image/gif";
841
- })(r || (r = {}));
842
- var i = function(t2, e2, n2, r2) {
843
- return new (n2 || (n2 = Promise))((function(o2, i2) {
844
- function a2(t3) {
845
- try {
846
- u2(r2.next(t3));
847
- } catch (t4) {
848
- i2(t4);
849
- }
850
- }
851
- function c3(t3) {
852
- try {
853
- u2(r2.throw(t3));
854
- } catch (t4) {
855
- i2(t4);
856
- }
857
- }
858
- function u2(t3) {
859
- var e3;
860
- t3.done ? o2(t3.value) : (e3 = t3.value, e3 instanceof n2 ? e3 : new n2((function(t4) {
861
- t4(e3);
862
- }))).then(a2, c3);
863
- }
864
- u2((r2 = r2.apply(t2, [])).next());
865
- }));
866
- };
867
- function a(t2, e2 = 0.92, n2 = r.JPEG) {
868
- return i(this, void 0, void 0, (function* () {
869
- return o(n2) || (n2 = r.JPEG), t2.toDataURL(n2, e2);
870
- }));
871
- }
872
- function c2(t2, e2 = 0.92, n2 = r.JPEG) {
873
- return new Promise((r2) => t2.toBlob((t3) => r2(t3), n2, e2));
874
- }
875
- var u = function(t2, e2, n2, r2) {
876
- return new (n2 || (n2 = Promise))((function(o2, i2) {
877
- function a2(t3) {
878
- try {
879
- u2(r2.next(t3));
880
- } catch (t4) {
881
- i2(t4);
882
- }
883
- }
884
- function c3(t3) {
885
- try {
886
- u2(r2.throw(t3));
887
- } catch (t4) {
888
- i2(t4);
889
- }
890
- }
891
- function u2(t3) {
892
- var e3;
893
- t3.done ? o2(t3.value) : (e3 = t3.value, e3 instanceof n2 ? e3 : new n2((function(t4) {
894
- t4(e3);
895
- }))).then(a2, c3);
896
- }
897
- u2((r2 = r2.apply(t2, [])).next());
898
- }));
899
- };
900
- function s(t2, e2) {
901
- return u(this, void 0, void 0, (function* () {
902
- const n2 = t2.split(",");
903
- let r2 = n2[0].match(/:(.*?);/)[1];
904
- const i2 = atob(n2[1]);
905
- let a2 = i2.length;
906
- const c3 = new Uint8Array(a2);
907
- for (; a2--; ) c3[a2] = i2.charCodeAt(a2);
908
- return o(e2) && (r2 = e2), new Blob([c3], { type: r2 });
909
- }));
910
- }
911
- function l(t2) {
912
- return new Promise((e2, n2) => {
913
- const r2 = new Image();
914
- r2.onload = () => e2(r2), r2.onerror = () => n2(new Error("dataURLtoImage(): dataURL is illegal")), r2.src = t2;
915
- });
916
- }
917
- function d(t2, e2) {
918
- const n2 = document.createElement("a");
919
- n2.href = window.URL.createObjectURL(t2), n2.download = e2 || Date.now().toString(36), document.body.appendChild(n2);
920
- const r2 = document.createEvent("MouseEvents");
921
- r2.initEvent("click", false, false), n2.dispatchEvent(r2), document.body.removeChild(n2);
922
- }
923
- function f(t2) {
924
- return new Promise((e2) => {
925
- const n2 = new FileReader();
926
- n2.onloadend = (t3) => e2(t3.target.result), n2.readAsDataURL(t2);
927
- });
928
- }
929
- var h2 = function(t2, e2, n2, r2) {
930
- return new (n2 || (n2 = Promise))((function(o2, i2) {
931
- function a2(t3) {
932
- try {
933
- u2(r2.next(t3));
934
- } catch (t4) {
935
- i2(t4);
936
- }
937
- }
938
- function c3(t3) {
939
- try {
940
- u2(r2.throw(t3));
941
- } catch (t4) {
942
- i2(t4);
943
- }
944
- }
945
- function u2(t3) {
946
- var e3;
947
- t3.done ? o2(t3.value) : (e3 = t3.value, e3 instanceof n2 ? e3 : new n2((function(t4) {
948
- t4(e3);
949
- }))).then(a2, c3);
950
- }
951
- u2((r2 = r2.apply(t2, [])).next());
952
- }));
953
- };
954
- function g2(t2, e2 = {}) {
955
- return h2(this, void 0, void 0, (function* () {
956
- const n2 = Object.assign({}, e2), r2 = document.createElement("canvas"), o2 = r2.getContext("2d");
957
- let i2, a2;
958
- for (const t3 in n2) Object.prototype.hasOwnProperty.call(n2, t3) && (n2[t3] = Number(n2[t3]));
959
- if (n2.scale) {
960
- const e3 = n2.scale > 0 && n2.scale < 10 ? n2.scale : 1;
961
- a2 = t2.width * e3, i2 = t2.height * e3;
962
- } else a2 = n2.width || n2.height * t2.width / t2.height || t2.width, i2 = n2.height || n2.width * t2.height / t2.width || t2.height;
963
- switch ([5, 6, 7, 8].some((t3) => t3 === n2.orientation) ? (r2.height = a2, r2.width = i2) : (r2.height = i2, r2.width = a2), n2.orientation) {
964
- case 3:
965
- o2.rotate(180 * Math.PI / 180), o2.drawImage(t2, -r2.width, -r2.height, r2.width, r2.height);
966
- break;
967
- case 6:
968
- o2.rotate(90 * Math.PI / 180), o2.drawImage(t2, 0, -r2.width, r2.height, r2.width);
969
- break;
970
- case 8:
971
- o2.rotate(270 * Math.PI / 180), o2.drawImage(t2, -r2.height, 0, r2.height, r2.width);
972
- break;
973
- case 2:
974
- o2.translate(r2.width, 0), o2.scale(-1, 1), o2.drawImage(t2, 0, 0, r2.width, r2.height);
975
- break;
976
- case 4:
977
- o2.translate(r2.width, 0), o2.scale(-1, 1), o2.rotate(180 * Math.PI / 180), o2.drawImage(t2, -r2.width, -r2.height, r2.width, r2.height);
978
- break;
979
- case 5:
980
- o2.translate(r2.width, 0), o2.scale(-1, 1), o2.rotate(90 * Math.PI / 180), o2.drawImage(t2, 0, -r2.width, r2.height, r2.width);
981
- break;
982
- case 7:
983
- o2.translate(r2.width, 0), o2.scale(-1, 1), o2.rotate(270 * Math.PI / 180), o2.drawImage(t2, -r2.height, 0, r2.height, r2.width);
984
- break;
985
- default:
986
- o2.drawImage(t2, 0, 0, r2.width, r2.height);
987
- }
988
- return r2;
989
- }));
990
- }
991
- function w(t2) {
992
- return fetch(t2).then((t3) => t3.blob());
993
- }
994
- function m(t2) {
995
- return new Promise((e2, n2) => {
996
- const r2 = new Image();
997
- r2.onload = () => e2(r2), r2.onerror = () => n2(new Error("urltoImage(): Image failed to load, please check the image URL")), r2.src = t2;
998
- });
999
- }
1000
- var y = function(t2, e2, n2, r2) {
1001
- return new (n2 || (n2 = Promise))((function(o2, i2) {
1002
- function a2(t3) {
1003
- try {
1004
- u2(r2.next(t3));
1005
- } catch (t4) {
1006
- i2(t4);
1007
- }
1008
- }
1009
- function c3(t3) {
1010
- try {
1011
- u2(r2.throw(t3));
1012
- } catch (t4) {
1013
- i2(t4);
1014
- }
1015
- }
1016
- function u2(t3) {
1017
- var e3;
1018
- t3.done ? o2(t3.value) : (e3 = t3.value, e3 instanceof n2 ? e3 : new n2((function(t4) {
1019
- t4(e3);
1020
- }))).then(a2, c3);
1021
- }
1022
- u2((r2 = r2.apply(t2, [])).next());
1023
- }));
1024
- };
1025
- function p2(t2, e2 = {}) {
1026
- return y(this, void 0, void 0, (function* () {
1027
- if (!(t2 instanceof Blob)) throw new Error("compress(): First arg must be a Blob object or a File object.");
1028
- if ("object" != typeof e2 && (e2 = Object.assign({ quality: e2 })), e2.quality = Number(e2.quality), Number.isNaN(e2.quality)) return t2;
1029
- const n2 = yield f(t2);
1030
- let i2 = n2.split(",")[0].match(/:(.*?);/)[1], c3 = r.JPEG;
1031
- o(e2.type) && (c3 = e2.type, i2 = e2.type);
1032
- const u2 = yield l(n2), d2 = yield g2(u2, Object.assign({}, e2)), h3 = yield a(d2, e2.quality, c3), w2 = yield s(h3, i2);
1033
- return w2.size > t2.size ? t2 : w2;
1034
- }));
1035
- }
1036
- function b(t2, e2 = {}) {
1037
- return y(this, void 0, void 0, (function* () {
1038
- if (!(t2 instanceof Blob)) throw new Error("compressAccurately(): First arg must be a Blob object or a File object.");
1039
- if ("object" != typeof e2 && (e2 = Object.assign({ size: e2 })), e2.size = Number(e2.size), Number.isNaN(e2.size)) return t2;
1040
- if (1024 * e2.size > t2.size) return t2;
1041
- e2.accuracy = Number(e2.accuracy), (!e2.accuracy || e2.accuracy < 0.8 || e2.accuracy > 0.99) && (e2.accuracy = 0.95);
1042
- const n2 = e2.size * (2 - e2.accuracy) * 1024, i2 = 1024 * e2.size, c3 = e2.size * e2.accuracy * 1024, u2 = yield f(t2);
1043
- let d2 = u2.split(",")[0].match(/:(.*?);/)[1], h3 = r.JPEG;
1044
- o(e2.type) && (h3 = e2.type, d2 = e2.type);
1045
- const w2 = yield l(u2), m2 = yield g2(w2, Object.assign({}, e2));
1046
- let y2, p3 = 0.5;
1047
- const b2 = [null, null];
1048
- for (let t3 = 1; t3 <= 7; t3++) {
1049
- y2 = yield a(m2, p3, h3);
1050
- const e3 = 0.75 * y2.length;
1051
- if (7 === t3) {
1052
- (n2 < e3 || c3 > e3) && (y2 = [y2, ...b2].filter((t4) => t4).sort((t4, e4) => Math.abs(0.75 * t4.length - i2) - Math.abs(0.75 * e4.length - i2))[0]);
1053
- break;
1054
- }
1055
- if (n2 < e3) b2[1] = y2, p3 -= Math.pow(0.5, t3 + 1);
1056
- else {
1057
- if (!(c3 > e3)) break;
1058
- b2[0] = y2, p3 += Math.pow(0.5, t3 + 1);
1059
- }
1060
- }
1061
- const v = yield s(y2, d2);
1062
- return v.size > t2.size ? t2 : v;
1063
- }));
1064
- }
1065
- }]);
1066
- }));
1067
- })(conversion$1);
1068
- return conversion$1.exports;
1069
- }
1070
- var imageConversion;
1071
- var hasRequiredImageConversion;
1072
- function requireImageConversion() {
1073
- if (hasRequiredImageConversion) return imageConversion;
1074
- hasRequiredImageConversion = 1;
1075
- imageConversion = requireConversion();
1076
- return imageConversion;
1077
- }
1078
- var imageConversionExports = requireImageConversion();
1079
- const _hoisted_1$a = { class: "component-upload-image" };
1080
- const _hoisted_2$7 = { class: "naive-image-card" };
1081
- const _hoisted_3$6 = ["src"];
1082
- const _hoisted_4$4 = {
1083
- key: 1,
1084
- class: "naive-image-card__progress"
1085
- };
1086
- const _hoisted_5$4 = { class: "naive-image-card__action" };
1087
- const _hoisted_6$3 = {
1088
- key: 0,
1089
- class: "naive-upload-tip"
1090
- };
1091
- const _hoisted_7$3 = {
1092
- key: 1,
1093
- class: "naive-upload-tip__text"
1094
- };
1095
- const _hoisted_8$2 = ["src"];
1096
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
1097
- __name: "ImageUpload",
1098
- props: {
1099
- modelValue: {
1100
- type: [String, Object, Array],
1101
- default: () => []
1102
- },
1103
- // 图片数量限制
1104
- limit: propTypes.number.def(5),
1105
- // 大小限制(MB)
1106
- fileSize: propTypes.number.def(5),
1107
- // 文件类型, 例如['png', 'jpg', 'jpeg']
1108
- fileType: propTypes.array.def(["png", "jpg", "jpeg"]),
1109
- // 是否显示提示
1110
- isShowTip: {
1111
- type: Boolean,
1112
- default: true
1113
- },
1114
- // 是否支持压缩,默认否
1115
- compressSupport: {
1116
- type: Boolean,
1117
- default: false
1118
- },
1119
- // 压缩目标大小,单位KB。默认300KB以上文件才压缩,并压缩至300KB以内
1120
- compressTargetSize: propTypes.number.def(300),
1121
- /**
1122
- * 提示展示方式。
1123
- * - inline:直接显示在组件下方(默认)
1124
- * - tooltip:收成一个问号图标,鼠标悬停才展示,适合表单很挤的场景
1125
- */
1126
- tipMode: {
1127
- type: String,
1128
- default: "inline"
1129
- },
1130
- // 自定义提示文案,传了则覆盖自动拼装的内容
1131
- tipText: propTypes.string.def(""),
1132
- // 推荐尺寸描述,例如 '256×256',会拼进提示里
1133
- recommendSize: propTypes.string.def(""),
1134
- // 禁用组件(仅查看图片)
1135
- disabled: propTypes.bool.def(false),
1136
- // 自定义上传地址(默认走 OSS)
1137
- action: propTypes.string.def("")
1138
- },
1139
- emits: ["update:modelValue", "upload-success"],
1140
- setup(__props, { emit: __emit }) {
1141
- const props = __props;
1142
- const { proxy } = getCurrentInstance();
1143
- const emit = __emit;
1144
- const number2 = ref(0);
1145
- const uploadList = ref([]);
1146
- const dialogImageUrl = ref("");
1147
- const dialogVisible = ref(false);
1148
- const baseUrl = getBaseUrl();
1149
- const resolvedAction = computed(() => props.action || baseUrl + "/resource/oss/upload");
1150
- const headers = ref(globalHeaders());
1151
- const fileList = ref([]);
1152
- const showTip = computed(() => props.isShowTip && (props.fileType || props.fileSize));
1153
- const imageUploadRef = ref();
1154
- const fileAccept = computed(() => props.fileType.map((type) => `.${type}`).join(","));
1155
- const tipContent = computed(() => {
1156
- var _a;
1157
- if (props.tipText) {
1158
- return props.tipText;
1159
- }
1160
- const parts = [];
1161
- if (props.recommendSize) {
1162
- parts.push(`建议尺寸 ${props.recommendSize}`);
1163
- }
1164
- if (props.fileSize) {
1165
- parts.push(`大小不超过 ${props.fileSize}MB`);
1166
- }
1167
- if ((_a = props.fileType) == null ? void 0 : _a.length) {
1168
- parts.push(`格式为 ${props.fileType.join("/")}`);
1169
- }
1170
- parts.push(`最多 ${props.limit} 张`);
1171
- return `请上传${parts.join("、")}的图片`;
1172
- });
1173
- watch(
1174
- () => props.modelValue,
1175
- async (val) => {
1176
- if (val) {
1177
- let list = [];
1178
- if (Array.isArray(val)) {
1179
- list = val;
1180
- } else {
1181
- const res = await listByIds(val);
1182
- list = res.data;
1183
- }
1184
- fileList.value = list.map((item) => {
1185
- let itemData;
1186
- if (typeof item === "string") {
1187
- itemData = { name: item, url: item, uid: `${item}` };
1188
- } else {
1189
- itemData = { name: item.ossId, url: item.url, ossId: item.ossId, uid: `${item.ossId}` };
1190
- }
1191
- return itemData;
1192
- });
1193
- } else {
1194
- fileList.value = [];
1195
- return [];
1196
- }
1197
- },
1198
- { deep: true, immediate: true }
1199
- );
1200
- const handleBeforeUpload = (file) => {
1201
- let isImg = false;
1202
- if (props.fileType.length) {
1203
- let fileExtension = "";
1204
- if (file.name.lastIndexOf(".") > -1) {
1205
- fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
1206
- }
1207
- isImg = props.fileType.some((type) => {
1208
- if (file.type.indexOf(type) > -1) return true;
1209
- if (fileExtension && fileExtension.indexOf(type) > -1) return true;
1210
- return false;
1211
- });
1212
- } else {
1213
- isImg = file.type.indexOf("image") > -1;
1214
- }
1215
- if (!isImg) {
1216
- proxy == null ? void 0 : proxy.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join("/")}图片格式文件!`);
1217
- return false;
1218
- }
1219
- if (file.name.includes(",")) {
1220
- proxy == null ? void 0 : proxy.$modal.msgError("文件名不正确,不能包含英文逗号!");
1221
- return false;
1222
- }
1223
- if (props.fileSize) {
1224
- const isLt = file.size / 1024 / 1024 < props.fileSize;
1225
- if (!isLt) {
1226
- proxy == null ? void 0 : proxy.$modal.msgError(`上传头像图片大小不能超过 ${props.fileSize} MB!`);
1227
- return false;
1228
- }
1229
- }
1230
- if (props.compressSupport && file.size / 1024 > props.compressTargetSize) {
1231
- proxy == null ? void 0 : proxy.$modal.loading("正在上传图片,请稍候...");
1232
- number2.value++;
1233
- return imageConversionExports.compressAccurately(file, props.compressTargetSize);
1234
- } else {
1235
- proxy == null ? void 0 : proxy.$modal.loading("正在上传图片,请稍候...");
1236
- number2.value++;
1237
- }
1238
- };
1239
- const handleExceed = () => {
1240
- proxy == null ? void 0 : proxy.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
1241
- };
1242
- const handleUploadSuccess = (res, file) => {
1243
- var _a;
1244
- if (res.code === 200) {
1245
- uploadList.value.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });
1246
- emit("upload-success", res.data);
1247
- uploadedSuccessfully();
1248
- } else {
1249
- number2.value--;
1250
- proxy == null ? void 0 : proxy.$modal.closeLoading();
1251
- proxy == null ? void 0 : proxy.$modal.msgError(res.msg);
1252
- (_a = imageUploadRef.value) == null ? void 0 : _a.handleRemove(file);
1253
- uploadedSuccessfully();
1254
- }
1255
- };
1256
- const handleRemove = (file) => {
1257
- const findex = fileList.value.findIndex((f) => f.uid === file.uid || f.name === file.name);
1258
- if (findex === -1) {
1259
- return;
1260
- }
1261
- const ossId = fileList.value[findex].ossId;
1262
- if (ossId) {
1263
- delOss(ossId);
1264
- }
1265
- fileList.value.splice(findex, 1);
1266
- emit("update:modelValue", listToString(fileList.value));
1267
- };
1268
- const uploadedSuccessfully = () => {
1269
- if (number2.value > 0 && uploadList.value.length === number2.value) {
1270
- fileList.value = fileList.value.filter((f) => f.url !== void 0).concat(uploadList.value);
1271
- uploadList.value = [];
1272
- number2.value = 0;
1273
- emit("update:modelValue", listToString(fileList.value));
1274
- proxy == null ? void 0 : proxy.$modal.closeLoading();
1275
- }
1276
- };
1277
- const handleUploadError = () => {
1278
- number2.value--;
1279
- proxy == null ? void 0 : proxy.$modal.closeLoading();
1280
- proxy == null ? void 0 : proxy.$modal.msgError("上传图片失败");
1281
- };
1282
- const handlePreview = (file) => {
1283
- dialogImageUrl.value = file.url;
1284
- dialogVisible.value = true;
1285
- };
1286
- const listToString = (list, separator) => {
1287
- let strs = "";
1288
- separator = separator || ",";
1289
- for (const i in list) {
1290
- if (void 0 !== list[i].ossId && list[i].url.indexOf("blob:") !== 0) {
1291
- strs += list[i].ossId + separator;
1292
- }
1293
- }
1294
- return strs != "" ? strs.substring(0, strs.length - 1) : "";
1295
- };
1296
- return (_ctx, _cache) => {
1297
- const _component_el_icon = resolveComponent("el-icon");
1298
- const _component_el_button = resolveComponent("el-button");
1299
- const _component_el_upload = resolveComponent("el-upload");
1300
- const _component_el_tooltip = resolveComponent("el-tooltip");
1301
- const _component_el_dialog = resolveComponent("el-dialog");
1302
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
1303
- createVNode(_component_el_upload, {
1304
- ref_key: "imageUploadRef",
1305
- ref: imageUploadRef,
1306
- "file-list": unref(fileList),
1307
- "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => isRef(fileList) ? fileList.value = $event : null),
1308
- accept: unref(fileAccept),
1309
- action: unref(resolvedAction),
1310
- "before-upload": handleBeforeUpload,
1311
- class: normalizeClass({ hide: unref(fileList).length >= __props.limit }),
1312
- headers: unref(headers),
1313
- limit: __props.limit,
1314
- multiple: __props.limit > 1,
1315
- "on-error": handleUploadError,
1316
- "on-exceed": handleExceed,
1317
- "on-success": handleUploadSuccess,
1318
- "list-type": "picture-card"
1319
- }, {
1320
- file: withCtx(({ file }) => [
1321
- createElementVNode("div", _hoisted_2$7, [
1322
- file.url ? (openBlock(), createElementBlock("img", {
1323
- key: 0,
1324
- alt: "",
1325
- class: "naive-image-card__img",
1326
- src: file.url
1327
- }, null, 8, _hoisted_3$6)) : createCommentVNode("", true),
1328
- file.status === "uploading" ? (openBlock(), createElementBlock("div", _hoisted_4$4, [
1329
- createElementVNode("div", {
1330
- class: "naive-image-card__bar",
1331
- style: normalizeStyle({ width: `${file.percentage || 0}%` })
1332
- }, null, 4)
1333
- ])) : createCommentVNode("", true),
1334
- createElementVNode("div", _hoisted_5$4, [
1335
- createVNode(_component_el_button, {
1336
- link: "",
1337
- icon: unref(ZoomIn),
1338
- onClick: ($event) => handlePreview(file)
1339
- }, null, 8, ["icon", "onClick"]),
1340
- !__props.disabled ? (openBlock(), createBlock(_component_el_button, {
1341
- key: 0,
1342
- link: "",
1343
- icon: unref(Delete),
1344
- onClick: ($event) => handleRemove(file)
1345
- }, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
1346
- ])
1347
- ])
1348
- ]),
1349
- default: withCtx(() => [
1350
- createVNode(_component_el_icon, { class: "naive-image-card__plus" }, {
1351
- default: withCtx(() => [
1352
- createVNode(unref(Plus))
1353
- ]),
1354
- _: 1
1355
- })
1356
- ]),
1357
- _: 1
1358
- }, 8, ["file-list", "accept", "action", "class", "headers", "limit", "multiple"]),
1359
- unref(showTip) ? (openBlock(), createElementBlock("div", _hoisted_6$3, [
1360
- __props.tipMode === "tooltip" ? (openBlock(), createBlock(_component_el_tooltip, {
1361
- key: 0,
1362
- content: unref(tipContent),
1363
- placement: "top"
1364
- }, {
1365
- default: withCtx(() => [
1366
- createVNode(_component_el_icon, { class: "naive-upload-tip__icon" }, {
1367
- default: withCtx(() => [
1368
- createVNode(unref(QuestionFilled))
1369
- ]),
1370
- _: 1
1371
- })
1372
- ]),
1373
- _: 1
1374
- }, 8, ["content"])) : (openBlock(), createElementBlock("span", _hoisted_7$3, toDisplayString(unref(tipContent)), 1))
1375
- ])) : createCommentVNode("", true),
1376
- createVNode(_component_el_dialog, {
1377
- modelValue: unref(dialogVisible),
1378
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(dialogVisible) ? dialogVisible.value = $event : null),
1379
- "append-to-body": "",
1380
- title: "预览",
1381
- width: "800px"
1382
- }, {
1383
- default: withCtx(() => [
1384
- createElementVNode("img", {
1385
- src: unref(dialogImageUrl),
1386
- style: { "display": "block", "max-width": "100%", "margin": "0 auto" }
1387
- }, null, 8, _hoisted_8$2)
1388
- ]),
1389
- _: 1
1390
- }, 8, ["modelValue"])
1391
- ]);
1392
- };
1393
- }
1394
- });
1395
- const ImageUpload = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-ab47c3bc"]]);
1396
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
747
+ const ImagePreview = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-81f8b791"]]);
748
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
1397
749
  ...{
1398
750
  name: "KCard",
1399
751
  inheritAttrs: false
@@ -1426,12 +778,77 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1426
778
  };
1427
779
  }
1428
780
  });
1429
- const KCard = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-cbf723b1"]]);
1430
- const _hoisted_1$9 = {
781
+ const KCard = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-33e2619b"]]);
782
+ const _hoisted_1$c = { class: "custom-tabs-wrapper" };
783
+ const _hoisted_2$7 = { class: "custom-tab-label" };
784
+ const _hoisted_3$6 = { class: "tab-text" };
785
+ const _hoisted_4$4 = { class: "custom-tabs-content" };
786
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
787
+ __name: "KCustomTabs",
788
+ props: {
789
+ modelValue: {},
790
+ tabs: {}
791
+ },
792
+ emits: ["update:modelValue", "tab-click"],
793
+ setup(__props, { emit: __emit }) {
794
+ const props = __props;
795
+ const emit = __emit;
796
+ const activeTab = computed({
797
+ get: () => props.modelValue,
798
+ set: (val) => emit("update:modelValue", val)
799
+ });
800
+ const handleTabClick = (pane) => {
801
+ emit("tab-click", pane);
802
+ };
803
+ return (_ctx, _cache) => {
804
+ const _component_el_icon = resolveComponent("el-icon");
805
+ const _component_el_tab_pane = resolveComponent("el-tab-pane");
806
+ const _component_el_tabs = resolveComponent("el-tabs");
807
+ return openBlock(), createElementBlock("div", _hoisted_1$c, [
808
+ createVNode(_component_el_tabs, {
809
+ modelValue: unref(activeTab),
810
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(activeTab) ? activeTab.value = $event : null),
811
+ class: "custom-tabs",
812
+ "tab-position": "left",
813
+ onTabClick: handleTabClick
814
+ }, {
815
+ default: withCtx(() => [
816
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tabs, (tab) => {
817
+ return openBlock(), createBlock(_component_el_tab_pane, {
818
+ key: tab.name,
819
+ label: tab.label,
820
+ name: tab.name
821
+ }, {
822
+ label: withCtx(() => [
823
+ createElementVNode("div", _hoisted_2$7, [
824
+ createVNode(_component_el_icon, { class: "tab-icon" }, {
825
+ default: withCtx(() => [
826
+ (openBlock(), createBlock(resolveDynamicComponent(tab.icon)))
827
+ ]),
828
+ _: 2
829
+ }, 1024),
830
+ createElementVNode("span", _hoisted_3$6, toDisplayString(tab.label), 1)
831
+ ])
832
+ ]),
833
+ _: 2
834
+ }, 1032, ["label", "name"]);
835
+ }), 128))
836
+ ]),
837
+ _: 1
838
+ }, 8, ["modelValue"]),
839
+ createElementVNode("div", _hoisted_4$4, [
840
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
841
+ ])
842
+ ]);
843
+ };
844
+ }
845
+ });
846
+ const KCustomTabs = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-0c28b114"]]);
847
+ const _hoisted_1$b = {
1431
848
  key: 0,
1432
849
  class: "dict-tag__text"
1433
850
  };
1434
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
851
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
1435
852
  __name: "KDictTag",
1436
853
  props: {
1437
854
  options: {},
@@ -1517,7 +934,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1517
934
  ], 64);
1518
935
  }), 128)),
1519
936
  unmatchedValues.value.length && _ctx.showValue ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1520
- displayMode.value === "text" ? (openBlock(), createElementBlock("span", _hoisted_1$9, toDisplayString(unmatchedText.value), 1)) : (openBlock(), createBlock(_component_el_tag, {
937
+ displayMode.value === "text" ? (openBlock(), createElementBlock("span", _hoisted_1$b, toDisplayString(unmatchedText.value), 1)) : (openBlock(), createBlock(_component_el_tag, {
1521
938
  key: 1,
1522
939
  class: "dict-tag__item dict-tag__item--fallback",
1523
940
  "disable-transitions": true,
@@ -1536,54 +953,428 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1536
953
  };
1537
954
  }
1538
955
  });
1539
- const KDictTag = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-f24d054e"]]);
1540
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1541
- ...{
1542
- name: "KPlainButton",
1543
- inheritAttrs: false
1544
- },
1545
- __name: "KPlainButton",
956
+ const KDictTag = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-1cfd13b2"]]);
957
+ const _hoisted_1$a = { class: "ip-segment-input" };
958
+ const _hoisted_2$6 = {
959
+ key: 0,
960
+ class: "ip-prefix"
961
+ };
962
+ const _hoisted_3$5 = { class: "ip-inputs" };
963
+ const _hoisted_4$3 = ["onUpdate:modelValue", "onInput", "onKeydown"];
964
+ const _hoisted_5$3 = {
965
+ key: 0,
966
+ class: "ip-dot"
967
+ };
968
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
969
+ __name: "KIpSegmentInput",
1546
970
  props: {
1547
- icon: {}
971
+ modelValue: {},
972
+ prefix: { default: "" },
973
+ segmentCount: { default: 1 }
1548
974
  },
1549
- setup(__props) {
975
+ emits: ["update:modelValue"],
976
+ setup(__props, { expose: __expose, emit: __emit }) {
977
+ const props = __props;
978
+ const emit = __emit;
979
+ const inputRefs = ref([]);
980
+ const setInputRef = (el, index) => {
981
+ if (el) {
982
+ inputRefs.value[index] = el;
983
+ }
984
+ };
985
+ const segments = reactive(Array.from({ length: props.segmentCount }, () => ({ value: "" })));
986
+ watch(
987
+ () => props.modelValue,
988
+ (newVal) => {
989
+ if (newVal) {
990
+ const parts = newVal.split(".");
991
+ parts.forEach((part, index) => {
992
+ if (index < segments.length) {
993
+ segments[index].value = part;
994
+ }
995
+ });
996
+ } else {
997
+ segments.forEach((seg) => seg.value = "");
998
+ }
999
+ },
1000
+ { immediate: true }
1001
+ );
1002
+ const updateValue = () => {
1003
+ const value = segments.map((seg) => seg.value).join(".");
1004
+ emit("update:modelValue", value);
1005
+ };
1006
+ const handleInput = (index, event) => {
1007
+ var _a;
1008
+ const input = event.target;
1009
+ let value = input.value;
1010
+ value = value.replace(/[^\d]/g, "");
1011
+ if (value) {
1012
+ const num = parseInt(value, 10);
1013
+ if (num > 255) {
1014
+ value = "255";
1015
+ }
1016
+ }
1017
+ segments[index].value = value;
1018
+ if (value.length === 3 && index < segments.length - 1) {
1019
+ (_a = inputRefs.value[index + 1]) == null ? void 0 : _a.focus();
1020
+ }
1021
+ updateValue();
1022
+ };
1023
+ const handleKeydown = (index, event) => {
1024
+ var _a, _b;
1025
+ const input = event.target;
1026
+ const value = input.value;
1027
+ if ((event.key === "." || event.key === "ArrowRight") && index < segments.length - 1) {
1028
+ event.preventDefault();
1029
+ inputRefs.value[index + 1].focus();
1030
+ }
1031
+ if (event.key === "ArrowLeft" && index > 0 && input.selectionStart === 0) {
1032
+ event.preventDefault();
1033
+ (_a = inputRefs.value[index - 1]) == null ? void 0 : _a.focus();
1034
+ }
1035
+ if (event.key === "Backspace" && !value && index > 0) {
1036
+ event.preventDefault();
1037
+ (_b = inputRefs.value[index - 1]) == null ? void 0 : _b.focus();
1038
+ }
1039
+ };
1040
+ const handlePaste = (event) => {
1041
+ var _a;
1042
+ event.preventDefault();
1043
+ const pasteData = ((_a = event.clipboardData) == null ? void 0 : _a.getData("text")) || "";
1044
+ const parts = pasteData.split(".").filter((p2) => /^\d+$/.test(p2));
1045
+ parts.forEach((part, index) => {
1046
+ if (index < segments.length) {
1047
+ const num = parseInt(part, 10);
1048
+ segments[index].value = num > 255 ? "255" : part;
1049
+ }
1050
+ });
1051
+ updateValue();
1052
+ };
1053
+ const focus = () => {
1054
+ var _a;
1055
+ (_a = inputRefs.value[0]) == null ? void 0 : _a.focus();
1056
+ };
1057
+ __expose({
1058
+ focus
1059
+ });
1550
1060
  return (_ctx, _cache) => {
1551
- const _component_el_button = resolveComponent("el-button");
1552
- return openBlock(), createBlock(_component_el_button, mergeProps({
1553
- class: "k-plain-button",
1554
- plain: ""
1555
- }, _ctx.$attrs), createSlots({
1556
- default: withCtx(() => [
1557
- renderSlot(_ctx.$slots, "default")
1558
- ]),
1559
- _: 2
1560
- }, [
1561
- _ctx.$slots.icon ? {
1562
- name: "icon",
1563
- fn: withCtx(() => [
1564
- renderSlot(_ctx.$slots, "icon")
1565
- ]),
1566
- key: "0"
1567
- } : _ctx.icon ? {
1568
- name: "icon",
1569
- fn: withCtx(() => [
1570
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
1571
- ]),
1572
- key: "1"
1573
- } : void 0
1574
- ]), 1040);
1061
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
1062
+ _ctx.prefix ? (openBlock(), createElementBlock("div", _hoisted_2$6, toDisplayString(_ctx.prefix), 1)) : createCommentVNode("", true),
1063
+ createElementVNode("div", _hoisted_3$5, [
1064
+ (openBlock(true), createElementBlock(Fragment, null, renderList(segments, (segment, index) => {
1065
+ return openBlock(), createElementBlock(Fragment, { key: index }, [
1066
+ withDirectives(createElementVNode("input", {
1067
+ ref_for: true,
1068
+ ref: (el) => setInputRef(el, index),
1069
+ "onUpdate:modelValue": ($event) => segment.value = $event,
1070
+ maxlength: 3,
1071
+ class: "ip-input",
1072
+ type: "text",
1073
+ onInput: ($event) => handleInput(index, $event),
1074
+ onKeydown: ($event) => handleKeydown(index, $event),
1075
+ onPaste: _cache[0] || (_cache[0] = ($event) => handlePaste($event))
1076
+ }, null, 40, _hoisted_4$3), [
1077
+ [vModelText, segment.value]
1078
+ ]),
1079
+ index < segments.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_5$3, ".")) : createCommentVNode("", true)
1080
+ ], 64);
1081
+ }), 128))
1082
+ ])
1083
+ ]);
1575
1084
  };
1576
1085
  }
1577
1086
  });
1578
- const _hoisted_1$8 = { class: "k-search-bar__title" };
1579
- const _hoisted_2$6 = { key: 1 };
1580
- const _hoisted_3$5 = { class: "k-search-bar__actions" };
1581
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1582
- ...{
1583
- name: "KSearchBar",
1584
- inheritAttrs: false
1585
- },
1586
- __name: "KSearchBar",
1087
+ const KIpSegmentInput = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-cc8f2ec6"]]);
1088
+ const easeInOutQuad = (t, b, c2, d) => {
1089
+ t /= d / 2;
1090
+ if (t < 1) {
1091
+ return c2 / 2 * t * t + b;
1092
+ }
1093
+ t--;
1094
+ return -c2 / 2 * (t * (t - 2) - 1) + b;
1095
+ };
1096
+ const requestAnimFrame = (function() {
1097
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
1098
+ window.setTimeout(callback, 1e3 / 60);
1099
+ };
1100
+ })();
1101
+ const move = (amount) => {
1102
+ document.documentElement.scrollTop = amount;
1103
+ document.body.parentNode.scrollTop = amount;
1104
+ document.body.scrollTop = amount;
1105
+ };
1106
+ const position = () => {
1107
+ return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;
1108
+ };
1109
+ const scrollTo = (to2, duration, callback) => {
1110
+ const start = position();
1111
+ const change = to2 - start;
1112
+ const increment = 20;
1113
+ let currentTime = 0;
1114
+ duration = typeof duration === "undefined" ? 500 : duration;
1115
+ const animateScroll = function() {
1116
+ currentTime += increment;
1117
+ const val = easeInOutQuad(currentTime, start, change, duration);
1118
+ move(val);
1119
+ if (currentTime < duration) {
1120
+ requestAnimFrame(animateScroll);
1121
+ }
1122
+ };
1123
+ animateScroll();
1124
+ };
1125
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
1126
+ __name: "KPagination",
1127
+ props: {
1128
+ total: propTypes.number,
1129
+ page: propTypes.number.def(1),
1130
+ limit: propTypes.number.def(20),
1131
+ pageSizes: { type: Array, default: () => [10, 20, 30, 50] },
1132
+ // 移动端页码按钮数量默认值 5,桌面端默认值 7
1133
+ pagerCount: propTypes.number.def(document.body.clientWidth < 992 ? 5 : 7),
1134
+ layout: propTypes.string.def("total, sizes, prev, pager, next, jumper"),
1135
+ background: propTypes.bool.def(true),
1136
+ autoScroll: propTypes.bool.def(true),
1137
+ hidden: propTypes.bool.def(false),
1138
+ float: propTypes.string.def("right")
1139
+ },
1140
+ emits: ["update:page", "update:limit", "pagination"],
1141
+ setup(__props, { emit: __emit }) {
1142
+ useCssVars((_ctx) => ({
1143
+ "c7f283a4": __props.float
1144
+ }));
1145
+ const props = __props;
1146
+ const emit = __emit;
1147
+ const currentPage = computed({
1148
+ get() {
1149
+ return props.page;
1150
+ },
1151
+ set(val) {
1152
+ emit("update:page", val);
1153
+ }
1154
+ });
1155
+ const pageSize = computed({
1156
+ get() {
1157
+ return props.limit;
1158
+ },
1159
+ set(val) {
1160
+ emit("update:limit", val);
1161
+ }
1162
+ });
1163
+ function handleSizeChange(val) {
1164
+ if (currentPage.value * val > props.total) {
1165
+ currentPage.value = 1;
1166
+ }
1167
+ emit("pagination", { page: currentPage.value, limit: val });
1168
+ if (props.autoScroll) {
1169
+ scrollTo(0, 800);
1170
+ }
1171
+ }
1172
+ function handleCurrentChange(val) {
1173
+ emit("pagination", { page: val, limit: pageSize.value });
1174
+ if (props.autoScroll) {
1175
+ scrollTo(0, 800);
1176
+ }
1177
+ }
1178
+ return (_ctx, _cache) => {
1179
+ const _component_el_pagination = resolveComponent("el-pagination");
1180
+ return openBlock(), createElementBlock("div", {
1181
+ class: normalizeClass([{ hidden: __props.hidden }, "pagination-container"])
1182
+ }, [
1183
+ createVNode(_component_el_pagination, {
1184
+ "current-page": unref(currentPage),
1185
+ "onUpdate:currentPage": _cache[0] || (_cache[0] = ($event) => isRef(currentPage) ? currentPage.value = $event : null),
1186
+ "page-size": unref(pageSize),
1187
+ "onUpdate:pageSize": _cache[1] || (_cache[1] = ($event) => isRef(pageSize) ? pageSize.value = $event : null),
1188
+ background: __props.background,
1189
+ layout: __props.layout,
1190
+ "page-sizes": __props.pageSizes,
1191
+ "pager-count": __props.pagerCount,
1192
+ total: __props.total,
1193
+ onSizeChange: handleSizeChange,
1194
+ onCurrentChange: handleCurrentChange
1195
+ }, null, 8, ["current-page", "page-size", "background", "layout", "page-sizes", "pager-count", "total"])
1196
+ ], 2);
1197
+ };
1198
+ }
1199
+ });
1200
+ const KPagination = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-e09bceac"]]);
1201
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1202
+ ...{
1203
+ name: "KPlainButton",
1204
+ inheritAttrs: false
1205
+ },
1206
+ __name: "KPlainButton",
1207
+ props: {
1208
+ icon: {}
1209
+ },
1210
+ setup(__props) {
1211
+ return (_ctx, _cache) => {
1212
+ const _component_el_button = resolveComponent("el-button");
1213
+ return openBlock(), createBlock(_component_el_button, mergeProps({
1214
+ class: "k-plain-button",
1215
+ plain: ""
1216
+ }, _ctx.$attrs), createSlots({
1217
+ default: withCtx(() => [
1218
+ renderSlot(_ctx.$slots, "default")
1219
+ ]),
1220
+ _: 2
1221
+ }, [
1222
+ _ctx.$slots.icon ? {
1223
+ name: "icon",
1224
+ fn: withCtx(() => [
1225
+ renderSlot(_ctx.$slots, "icon")
1226
+ ]),
1227
+ key: "0"
1228
+ } : _ctx.icon ? {
1229
+ name: "icon",
1230
+ fn: withCtx(() => [
1231
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
1232
+ ]),
1233
+ key: "1"
1234
+ } : void 0
1235
+ ]), 1040);
1236
+ };
1237
+ }
1238
+ });
1239
+ const _hoisted_1$9 = { class: "show-btn" };
1240
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
1241
+ __name: "KRightToolbar",
1242
+ props: {
1243
+ showSearch: propTypes.bool.def(true),
1244
+ columns: { type: Array, default: void 0 },
1245
+ search: propTypes.bool.def(true),
1246
+ gutter: propTypes.number.def(10)
1247
+ },
1248
+ emits: ["update:showSearch", "queryTable"],
1249
+ setup(__props, { emit: __emit }) {
1250
+ const props = __props;
1251
+ const columnRef = ref();
1252
+ const emits = __emit;
1253
+ const style = computed(() => {
1254
+ const ret = {};
1255
+ if (props.gutter) {
1256
+ ret.marginRight = `${props.gutter / 2}px`;
1257
+ }
1258
+ return ret;
1259
+ });
1260
+ function toggleSearch() {
1261
+ emits("update:showSearch", !props.showSearch);
1262
+ }
1263
+ function refresh() {
1264
+ emits("queryTable");
1265
+ }
1266
+ function columnChange(...args) {
1267
+ var _a;
1268
+ (_a = props.columns) == null ? void 0 : _a.forEach((item) => {
1269
+ item.visible = args[1].checkedKeys.includes(item.key);
1270
+ });
1271
+ }
1272
+ onMounted(() => {
1273
+ var _a;
1274
+ (_a = props.columns) == null ? void 0 : _a.forEach((item) => {
1275
+ var _a2;
1276
+ if (item.visible) {
1277
+ (_a2 = columnRef.value) == null ? void 0 : _a2.setChecked(item.key, true, false);
1278
+ }
1279
+ });
1280
+ });
1281
+ return (_ctx, _cache) => {
1282
+ const _component_el_button = resolveComponent("el-button");
1283
+ const _component_el_tooltip = resolveComponent("el-tooltip");
1284
+ const _component_el_tree = resolveComponent("el-tree");
1285
+ const _component_el_popover = resolveComponent("el-popover");
1286
+ const _component_el_row = resolveComponent("el-row");
1287
+ return openBlock(), createElementBlock("div", {
1288
+ class: "top-right-btn",
1289
+ style: normalizeStyle(unref(style))
1290
+ }, [
1291
+ createVNode(_component_el_row, null, {
1292
+ default: withCtx(() => [
1293
+ __props.search ? (openBlock(), createBlock(_component_el_tooltip, {
1294
+ key: 0,
1295
+ class: "item",
1296
+ effect: "dark",
1297
+ content: __props.showSearch ? "隐藏搜索" : "显示搜索",
1298
+ placement: "top"
1299
+ }, {
1300
+ default: withCtx(() => [
1301
+ createVNode(_component_el_button, {
1302
+ circle: "",
1303
+ icon: "Search",
1304
+ onClick: _cache[0] || (_cache[0] = ($event) => toggleSearch())
1305
+ })
1306
+ ]),
1307
+ _: 1
1308
+ }, 8, ["content"])) : createCommentVNode("", true),
1309
+ createVNode(_component_el_tooltip, {
1310
+ class: "item",
1311
+ effect: "dark",
1312
+ content: "刷新",
1313
+ placement: "top"
1314
+ }, {
1315
+ default: withCtx(() => [
1316
+ createVNode(_component_el_button, {
1317
+ circle: "",
1318
+ icon: "Refresh",
1319
+ onClick: _cache[1] || (_cache[1] = ($event) => refresh())
1320
+ })
1321
+ ]),
1322
+ _: 1
1323
+ }),
1324
+ __props.columns ? (openBlock(), createBlock(_component_el_tooltip, {
1325
+ key: 1,
1326
+ class: "item",
1327
+ effect: "dark",
1328
+ content: "显示/隐藏列",
1329
+ placement: "top"
1330
+ }, {
1331
+ default: withCtx(() => [
1332
+ createElementVNode("div", _hoisted_1$9, [
1333
+ createVNode(_component_el_popover, {
1334
+ placement: "bottom",
1335
+ trigger: "click"
1336
+ }, {
1337
+ reference: withCtx(() => [
1338
+ createVNode(_component_el_button, {
1339
+ circle: "",
1340
+ icon: "Menu"
1341
+ })
1342
+ ]),
1343
+ default: withCtx(() => [
1344
+ _cache[2] || (_cache[2] = createElementVNode("div", { class: "tree-header" }, "显示/隐藏列", -1)),
1345
+ createVNode(_component_el_tree, {
1346
+ ref_key: "columnRef",
1347
+ ref: columnRef,
1348
+ data: __props.columns,
1349
+ "show-checkbox": "",
1350
+ "node-key": "key",
1351
+ props: { label: "label", children: "children" },
1352
+ onCheck: columnChange
1353
+ }, null, 8, ["data"])
1354
+ ]),
1355
+ _: 1
1356
+ })
1357
+ ])
1358
+ ]),
1359
+ _: 1
1360
+ })) : createCommentVNode("", true)
1361
+ ]),
1362
+ _: 1
1363
+ })
1364
+ ], 4);
1365
+ };
1366
+ }
1367
+ });
1368
+ const KRightToolbar = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-7c7062c5"]]);
1369
+ const _hoisted_1$8 = { class: "k-search-bar__title" };
1370
+ const _hoisted_2$5 = { key: 1 };
1371
+ const _hoisted_3$4 = { class: "k-search-bar__actions" };
1372
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
1373
+ ...{
1374
+ name: "KSearchBar",
1375
+ inheritAttrs: false
1376
+ },
1377
+ __name: "KSearchBar",
1587
1378
  props: /* @__PURE__ */ mergeModels({
1588
1379
  items: { default: () => [] },
1589
1380
  span: { default: 6 },
@@ -1875,7 +1666,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1875
1666
  item.label ? {
1876
1667
  name: "label",
1877
1668
  fn: withCtx(() => [
1878
- typeof item.label !== "string" ? (openBlock(), createBlock(resolveDynamicComponent(item.label), { key: 0 })) : (openBlock(), createElementBlock("span", _hoisted_2$6, toDisplayString(item.label), 1))
1669
+ typeof item.label !== "string" ? (openBlock(), createBlock(resolveDynamicComponent(item.label), { key: 0 })) : (openBlock(), createElementBlock("span", _hoisted_2$5, toDisplayString(item.label), 1))
1879
1670
  ]),
1880
1671
  key: "0"
1881
1672
  } : void 0
@@ -1893,7 +1684,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1893
1684
  class: "k-search-bar__actions-col"
1894
1685
  }, {
1895
1686
  default: withCtx(() => [
1896
- createElementVNode("div", _hoisted_3$5, [
1687
+ createElementVNode("div", _hoisted_3$4, [
1897
1688
  renderSlot(_ctx.$slots, "actions-before", { modelValue: modelValue.value }, void 0, true),
1898
1689
  _ctx.showReset ? (openBlock(), createBlock(_component_el_button, {
1899
1690
  key: 0,
@@ -1937,9 +1728,75 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1937
1728
  };
1938
1729
  }
1939
1730
  });
1940
- const KSearchBar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-995c528d"]]);
1941
- const _hoisted_1$7 = { class: "title" };
1731
+ const KSearchBar = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-af898010"]]);
1732
+ const _hoisted_1$7 = { class: "section-title" };
1733
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
1734
+ __name: "KSectionTitle",
1735
+ props: {
1736
+ title: {}
1737
+ },
1738
+ setup(__props) {
1739
+ return (_ctx, _cache) => {
1740
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
1741
+ renderSlot(_ctx.$slots, "default", {}, () => [
1742
+ createTextVNode(toDisplayString(_ctx.title), 1)
1743
+ ], true)
1744
+ ]);
1745
+ };
1746
+ }
1747
+ });
1748
+ const KSectionTitle = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-0504fe3f"]]);
1942
1749
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1750
+ ...{
1751
+ name: "KSegmented",
1752
+ inheritAttrs: false
1753
+ },
1754
+ __name: "KSegmented",
1755
+ props: {
1756
+ modelValue: {
1757
+ type: [String, Number, Boolean],
1758
+ required: true
1759
+ },
1760
+ options: {
1761
+ type: Array,
1762
+ required: true
1763
+ },
1764
+ size: {
1765
+ type: String,
1766
+ default: "default"
1767
+ },
1768
+ block: {
1769
+ type: Boolean,
1770
+ default: false
1771
+ },
1772
+ disabled: {
1773
+ type: Boolean,
1774
+ default: false
1775
+ }
1776
+ },
1777
+ emits: ["update:modelValue", "change"],
1778
+ setup(__props, { emit: __emit }) {
1779
+ const emit = __emit;
1780
+ const handleUpdate = (value) => {
1781
+ emit("update:modelValue", value);
1782
+ emit("change", value);
1783
+ };
1784
+ return (_ctx, _cache) => {
1785
+ const _component_el_segmented = resolveComponent("el-segmented");
1786
+ return openBlock(), createBlock(_component_el_segmented, mergeProps({
1787
+ block: __props.block,
1788
+ disabled: __props.disabled,
1789
+ "model-value": __props.modelValue,
1790
+ options: __props.options,
1791
+ size: __props.size,
1792
+ class: "k-segmented"
1793
+ }, _ctx.$attrs, { "onUpdate:modelValue": handleUpdate }), null, 16, ["block", "disabled", "model-value", "options", "size"]);
1794
+ };
1795
+ }
1796
+ });
1797
+ const KSegmented = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-9ee2c3c5"]]);
1798
+ const _hoisted_1$6 = { class: "title" };
1799
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1943
1800
  ...{ name: "KSelectedAlert" },
1944
1801
  __name: "KSelectedAlert",
1945
1802
  props: {
@@ -1957,7 +1814,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1957
1814
  type: "primary"
1958
1815
  }, {
1959
1816
  title: withCtx(() => [
1960
- createElementVNode("span", _hoisted_1$7, toDisplayString(_ctx.count > 0 ? `已选择 ${_ctx.count} 条记录` : "未选中任何记录"), 1),
1817
+ createElementVNode("span", _hoisted_1$6, toDisplayString(_ctx.count > 0 ? `已选择 ${_ctx.count} 条记录` : "未选中任何记录"), 1),
1961
1818
  _ctx.count > 0 ? (openBlock(), createBlock(_component_el_link, {
1962
1819
  key: 0,
1963
1820
  underline: false,
@@ -1975,9 +1832,69 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1975
1832
  };
1976
1833
  }
1977
1834
  });
1978
- const KSelectedAlert = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-cf66b3b3"]]);
1979
- const _hoisted_1$6 = { key: 0 };
1980
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
1835
+ const KSelectedAlert = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-88969fb9"]]);
1836
+ const _hoisted_1$5 = { class: "k-spin__indicator" };
1837
+ const _hoisted_2$4 = {
1838
+ key: 0,
1839
+ class: "k-spin__description"
1840
+ };
1841
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1842
+ ...{ name: "KSpin" },
1843
+ __name: "KSpin",
1844
+ props: {
1845
+ show: { type: Boolean, default: false },
1846
+ size: { default: 28 },
1847
+ description: { default: "" },
1848
+ background: { default: "rgba(255, 255, 255, 0.72)" },
1849
+ contentClass: { default: "" }
1850
+ },
1851
+ setup(__props) {
1852
+ const props = __props;
1853
+ const maskStyle = computed(() => ({
1854
+ background: props.background
1855
+ }));
1856
+ return (_ctx, _cache) => {
1857
+ const _component_el_icon = resolveComponent("el-icon");
1858
+ return openBlock(), createElementBlock("div", {
1859
+ class: normalizeClass(["k-spin", { "is-active": _ctx.show }])
1860
+ }, [
1861
+ createElementVNode("div", {
1862
+ class: normalizeClass(["k-spin__content", _ctx.contentClass])
1863
+ }, [
1864
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
1865
+ ], 2),
1866
+ createVNode(Transition, { name: "k-spin-fade" }, {
1867
+ default: withCtx(() => [
1868
+ _ctx.show ? (openBlock(), createElementBlock("div", {
1869
+ key: 0,
1870
+ class: "k-spin__mask",
1871
+ style: normalizeStyle(unref(maskStyle))
1872
+ }, [
1873
+ renderSlot(_ctx.$slots, "spin", {}, () => [
1874
+ createElementVNode("div", _hoisted_1$5, [
1875
+ createVNode(_component_el_icon, {
1876
+ class: "k-spin__icon is-loading",
1877
+ size: _ctx.size
1878
+ }, {
1879
+ default: withCtx(() => [
1880
+ createVNode(unref(Loading))
1881
+ ]),
1882
+ _: 1
1883
+ }, 8, ["size"]),
1884
+ _ctx.description ? (openBlock(), createElementBlock("p", _hoisted_2$4, toDisplayString(_ctx.description), 1)) : createCommentVNode("", true)
1885
+ ])
1886
+ ], true)
1887
+ ], 4)) : createCommentVNode("", true)
1888
+ ]),
1889
+ _: 3
1890
+ })
1891
+ ], 2);
1892
+ };
1893
+ }
1894
+ });
1895
+ const KSpin = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-d7f6a57b"]]);
1896
+ const _hoisted_1$4 = { key: 0 };
1897
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1981
1898
  ...{ name: "KTable", inheritAttrs: false },
1982
1899
  __name: "KTable",
1983
1900
  props: {
@@ -2093,7 +2010,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2093
2010
  ref: elTableRef
2094
2011
  }, unref(mergedTableProps), { onSelectionChange: handleSelectionChange }), {
2095
2012
  empty: withCtx(() => [
2096
- _ctx.loading ? (openBlock(), createElementBlock("div", _hoisted_1$6)) : (openBlock(), createBlock(_component_el_empty, {
2013
+ _ctx.loading ? (openBlock(), createElementBlock("div", _hoisted_1$4)) : (openBlock(), createBlock(_component_el_empty, {
2097
2014
  key: 1,
2098
2015
  description: _ctx.emptyText,
2099
2016
  "image-size": 120
@@ -2162,7 +2079,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2162
2079
  };
2163
2080
  }
2164
2081
  });
2165
- const KTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-05ba2501"]]);
2082
+ const KTable = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-cf2daced"]]);
2166
2083
  var an = Object.defineProperty;
2167
2084
  var Pe = Object.getOwnPropertySymbols;
2168
2085
  var yt = Object.prototype.hasOwnProperty, wt = Object.prototype.propertyIsEnumerable;
@@ -3759,18 +3676,18 @@ const ft = [
3759
3676
  };
3760
3677
  }
3761
3678
  });
3762
- const _hoisted_1$5 = { class: "k-table-header__left" };
3763
- const _hoisted_2$5 = {
3679
+ const _hoisted_1$3 = { class: "k-table-header__left" };
3680
+ const _hoisted_2$3 = {
3764
3681
  key: 0,
3765
3682
  class: "k-table-header__title"
3766
3683
  };
3767
- const _hoisted_3$4 = { class: "k-table-header__right" };
3768
- const _hoisted_4$3 = { class: "column-panel" };
3769
- const _hoisted_5$3 = { class: "column-panel__select-all" };
3770
- const _hoisted_6$2 = { class: "column-item__main" };
3771
- const _hoisted_7$2 = { class: "column-item__label" };
3684
+ const _hoisted_3$3 = { class: "k-table-header__right" };
3685
+ const _hoisted_4$2 = { class: "column-panel" };
3686
+ const _hoisted_5$2 = { class: "column-panel__select-all" };
3687
+ const _hoisted_6$1 = { class: "column-item__main" };
3688
+ const _hoisted_7$1 = { class: "column-item__label" };
3772
3689
  const _hoisted_8$1 = ["disabled", "onClick"];
3773
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3690
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3774
3691
  ...{ name: "KTableHeader" },
3775
3692
  __name: "KTableHeader",
3776
3693
  props: /* @__PURE__ */ mergeModels({
@@ -3900,12 +3817,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3900
3817
  ref: headerRef,
3901
3818
  class: "k-table-header"
3902
3819
  }, [
3903
- createElementVNode("div", _hoisted_1$5, [
3820
+ createElementVNode("div", _hoisted_1$3, [
3904
3821
  renderSlot(_ctx.$slots, "title", {}, () => [
3905
- _ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2$5, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true)
3822
+ _ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2$3, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true)
3906
3823
  ], true)
3907
3824
  ]),
3908
- createElementVNode("div", _hoisted_3$4, [
3825
+ createElementVNode("div", _hoisted_3$3, [
3909
3826
  renderSlot(_ctx.$slots, "right", {}, void 0, true),
3910
3827
  shouldShow("refresh") ? (openBlock(), createBlock(_component_KPlainButton, {
3911
3828
  key: 0,
@@ -3942,8 +3859,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3942
3859
  }, 8, ["icon"])
3943
3860
  ]),
3944
3861
  default: withCtx(() => [
3945
- createElementVNode("div", _hoisted_4$3, [
3946
- createElementVNode("div", _hoisted_5$3, [
3862
+ createElementVNode("div", _hoisted_4$2, [
3863
+ createElementVNode("div", _hoisted_5$2, [
3947
3864
  createVNode(_component_el_checkbox, {
3948
3865
  disabled: unref(visibleStats).total === 0,
3949
3866
  indeterminate: unref(selectAllIndeterminate),
@@ -3973,7 +3890,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3973
3890
  key: String(item.key),
3974
3891
  class: "column-item"
3975
3892
  }, [
3976
- createElementVNode("div", _hoisted_6$2, [
3893
+ createElementVNode("div", _hoisted_6$1, [
3977
3894
  createVNode(_component_el_icon, { class: "column-item__drag" }, {
3978
3895
  default: withCtx(() => [
3979
3896
  createVNode(unref(Rank))
@@ -3987,7 +3904,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3987
3904
  onChange: (value) => handleCheckedChange(item, value)
3988
3905
  }, {
3989
3906
  default: withCtx(() => [
3990
- createElementVNode("span", _hoisted_7$2, toDisplayString(item.label), 1)
3907
+ createElementVNode("span", _hoisted_7$1, toDisplayString(item.label), 1)
3991
3908
  ]),
3992
3909
  _: 2
3993
3910
  }, 1032, ["disabled", "model-value", "onChange"])
@@ -4029,71 +3946,456 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4029
3946
  };
4030
3947
  }
4031
3948
  });
4032
- const KTableHeader = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-b92b8ec9"]]);
4033
- const _hoisted_1$4 = { class: "setting-form" };
4034
- const _hoisted_2$4 = { class: "form-content" };
4035
- const _hoisted_3$3 = { class: "form-footer" };
4036
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4037
- __name: "SettingForm",
4038
- props: {
4039
- title: { default: "" },
4040
- formData: {},
4041
- defaultData: { default: () => ({}) },
4042
- rules: { default: () => ({}) },
4043
- loading: { type: Boolean, default: false }
4044
- },
4045
- emits: ["save", "reset", "cancel", "reset-default"],
4046
- setup(__props, { expose: __expose, emit: __emit }) {
4047
- const props = __props;
4048
- const emit = __emit;
4049
- const formRef = ref();
4050
- const isEditing = ref(false);
4051
- const originalData = ref({});
4052
- const handleEdit = () => {
4053
- originalData.value = JSON.parse(JSON.stringify(props.formData));
4054
- isEditing.value = true;
4055
- };
4056
- const handleSave = async () => {
4057
- if (!formRef.value) return;
4058
- await formRef.value.validate((valid) => {
4059
- if (valid) {
4060
- emit("save", props.formData);
4061
- }
4062
- });
4063
- };
4064
- const handleReset = () => {
4065
- if (formRef.value) {
4066
- formRef.value.resetFields();
4067
- }
4068
- emit("reset");
4069
- };
4070
- const handleCancel = () => {
4071
- Object.assign(props.formData, originalData.value);
4072
- isEditing.value = false;
4073
- if (formRef.value) {
4074
- formRef.value.clearValidate();
4075
- }
4076
- emit("cancel");
4077
- };
4078
- const handleResetToDefault = () => {
4079
- emit("reset-default");
4080
- };
4081
- const exitEditMode = () => {
4082
- isEditing.value = false;
4083
- };
4084
- __expose({
4085
- exitEditMode
4086
- });
4087
- return (_ctx, _cache) => {
4088
- const _component_el_form = resolveComponent("el-form");
3949
+ const KTableHeader = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-94c8dd86"]]);
3950
+ function tryOnScopeDispose(fn) {
3951
+ if (getCurrentScope()) {
3952
+ onScopeDispose(fn);
3953
+ return true;
3954
+ }
3955
+ return false;
3956
+ }
3957
+ const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
3958
+ const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
3959
+ var _a;
3960
+ const key = args[0];
3961
+ const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
3962
+ if (instance == null && !hasInjectionContext())
3963
+ throw new Error("injectLocal must be called in setup");
3964
+ if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
3965
+ return localProvidedStateMap.get(instance)[key];
3966
+ return inject(...args);
3967
+ };
3968
+ const isClient = typeof window !== "undefined" && typeof document !== "undefined";
3969
+ typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
3970
+ const toString = Object.prototype.toString;
3971
+ const isObject = (val) => toString.call(val) === "[object Object]";
3972
+ function increaseWithUnit(target, delta) {
3973
+ var _a;
3974
+ if (typeof target === "number")
3975
+ return target + delta;
3976
+ const value = ((_a = target.match(/^-?\d+\.?\d*/)) == null ? void 0 : _a[0]) || "";
3977
+ const unit = target.slice(value.length);
3978
+ const result = Number.parseFloat(value) + delta;
3979
+ if (Number.isNaN(result))
3980
+ return target;
3981
+ return result + unit;
3982
+ }
3983
+ function pxValue(px) {
3984
+ return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
3985
+ }
3986
+ function toArray(value) {
3987
+ return Array.isArray(value) ? value : [value];
3988
+ }
3989
+ function getLifeCycleTarget(target) {
3990
+ return getCurrentInstance();
3991
+ }
3992
+ function tryOnMounted(fn, sync = true, target) {
3993
+ const instance = getLifeCycleTarget();
3994
+ if (instance)
3995
+ onMounted(fn, target);
3996
+ else if (sync)
3997
+ fn();
3998
+ else
3999
+ nextTick(fn);
4000
+ }
4001
+ function watchImmediate(source, cb, options) {
4002
+ return watch(
4003
+ source,
4004
+ cb,
4005
+ {
4006
+ ...options,
4007
+ immediate: true
4008
+ }
4009
+ );
4010
+ }
4011
+ const defaultWindow = isClient ? window : void 0;
4012
+ function unrefElement(elRef) {
4013
+ var _a;
4014
+ const plain = toValue(elRef);
4015
+ return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
4016
+ }
4017
+ function useEventListener(...args) {
4018
+ const cleanups = [];
4019
+ const cleanup = () => {
4020
+ cleanups.forEach((fn) => fn());
4021
+ cleanups.length = 0;
4022
+ };
4023
+ const register = (el, event, listener, options) => {
4024
+ el.addEventListener(event, listener, options);
4025
+ return () => el.removeEventListener(event, listener, options);
4026
+ };
4027
+ const firstParamTargets = computed(() => {
4028
+ const test = toArray(toValue(args[0])).filter((e) => e != null);
4029
+ return test.every((e) => typeof e !== "string") ? test : void 0;
4030
+ });
4031
+ const stopWatch = watchImmediate(
4032
+ () => {
4033
+ var _a, _b;
4034
+ return [
4035
+ (_b = (_a = firstParamTargets.value) == null ? void 0 : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
4036
+ toArray(toValue(firstParamTargets.value ? args[1] : args[0])),
4037
+ toArray(unref(firstParamTargets.value ? args[2] : args[1])),
4038
+ // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
4039
+ toValue(firstParamTargets.value ? args[3] : args[2])
4040
+ ];
4041
+ },
4042
+ ([raw_targets, raw_events, raw_listeners, raw_options]) => {
4043
+ cleanup();
4044
+ if (!(raw_targets == null ? void 0 : raw_targets.length) || !(raw_events == null ? void 0 : raw_events.length) || !(raw_listeners == null ? void 0 : raw_listeners.length))
4045
+ return;
4046
+ const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
4047
+ cleanups.push(
4048
+ ...raw_targets.flatMap(
4049
+ (el) => raw_events.flatMap(
4050
+ (event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))
4051
+ )
4052
+ )
4053
+ );
4054
+ },
4055
+ { flush: "post" }
4056
+ );
4057
+ const stop = () => {
4058
+ stopWatch();
4059
+ cleanup();
4060
+ };
4061
+ tryOnScopeDispose(cleanup);
4062
+ return stop;
4063
+ }
4064
+ // @__NO_SIDE_EFFECTS__
4065
+ function useMounted() {
4066
+ const isMounted = shallowRef(false);
4067
+ const instance = getCurrentInstance();
4068
+ if (instance) {
4069
+ onMounted(() => {
4070
+ isMounted.value = true;
4071
+ }, instance);
4072
+ }
4073
+ return isMounted;
4074
+ }
4075
+ // @__NO_SIDE_EFFECTS__
4076
+ function useSupported(callback) {
4077
+ const isMounted = /* @__PURE__ */ useMounted();
4078
+ return computed(() => {
4079
+ isMounted.value;
4080
+ return Boolean(callback());
4081
+ });
4082
+ }
4083
+ const ssrWidthSymbol = Symbol("vueuse-ssr-width");
4084
+ // @__NO_SIDE_EFFECTS__
4085
+ function useSSRWidth() {
4086
+ const ssrWidth = hasInjectionContext() ? /* @__PURE__ */ injectLocal(ssrWidthSymbol, null) : null;
4087
+ return typeof ssrWidth === "number" ? ssrWidth : void 0;
4088
+ }
4089
+ function useMediaQuery(query, options = {}) {
4090
+ const { window: window2 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
4091
+ const isSupported = /* @__PURE__ */ useSupported(() => window2 && "matchMedia" in window2 && typeof window2.matchMedia === "function");
4092
+ const ssrSupport = shallowRef(typeof ssrWidth === "number");
4093
+ const mediaQuery = shallowRef();
4094
+ const matches = shallowRef(false);
4095
+ const handler = (event) => {
4096
+ matches.value = event.matches;
4097
+ };
4098
+ watchEffect(() => {
4099
+ if (ssrSupport.value) {
4100
+ ssrSupport.value = !isSupported.value;
4101
+ const queryStrings = toValue(query).split(",");
4102
+ matches.value = queryStrings.some((queryString) => {
4103
+ const not = queryString.includes("not all");
4104
+ const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
4105
+ const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
4106
+ let res = Boolean(minWidth || maxWidth);
4107
+ if (minWidth && res) {
4108
+ res = ssrWidth >= pxValue(minWidth[1]);
4109
+ }
4110
+ if (maxWidth && res) {
4111
+ res = ssrWidth <= pxValue(maxWidth[1]);
4112
+ }
4113
+ return not ? !res : res;
4114
+ });
4115
+ return;
4116
+ }
4117
+ if (!isSupported.value)
4118
+ return;
4119
+ mediaQuery.value = window2.matchMedia(toValue(query));
4120
+ matches.value = mediaQuery.value.matches;
4121
+ });
4122
+ useEventListener(mediaQuery, "change", handler, { passive: true });
4123
+ return computed(() => matches.value);
4124
+ }
4125
+ const breakpointsTailwind = {
4126
+ "sm": 640,
4127
+ "md": 768,
4128
+ "lg": 1024,
4129
+ "xl": 1280,
4130
+ "2xl": 1536
4131
+ };
4132
+ // @__NO_SIDE_EFFECTS__
4133
+ function useBreakpoints(breakpoints, options = {}) {
4134
+ function getValue(k, delta) {
4135
+ let v = toValue(breakpoints[toValue(k)]);
4136
+ if (delta != null)
4137
+ v = increaseWithUnit(v, delta);
4138
+ if (typeof v === "number")
4139
+ v = `${v}px`;
4140
+ return v;
4141
+ }
4142
+ const { window: window2 = defaultWindow, strategy = "min-width", ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
4143
+ const ssrSupport = typeof ssrWidth === "number";
4144
+ const mounted = ssrSupport ? shallowRef(false) : { value: true };
4145
+ if (ssrSupport) {
4146
+ tryOnMounted(() => mounted.value = !!window2);
4147
+ }
4148
+ function match(query, size) {
4149
+ if (!mounted.value && ssrSupport) {
4150
+ return query === "min" ? ssrWidth >= pxValue(size) : ssrWidth <= pxValue(size);
4151
+ }
4152
+ if (!window2)
4153
+ return false;
4154
+ return window2.matchMedia(`(${query}-width: ${size})`).matches;
4155
+ }
4156
+ const greaterOrEqual = (k) => {
4157
+ return useMediaQuery(() => `(min-width: ${getValue(k)})`, options);
4158
+ };
4159
+ const smallerOrEqual = (k) => {
4160
+ return useMediaQuery(() => `(max-width: ${getValue(k)})`, options);
4161
+ };
4162
+ const shortcutMethods = Object.keys(breakpoints).reduce((shortcuts, k) => {
4163
+ Object.defineProperty(shortcuts, k, {
4164
+ get: () => strategy === "min-width" ? greaterOrEqual(k) : smallerOrEqual(k),
4165
+ enumerable: true,
4166
+ configurable: true
4167
+ });
4168
+ return shortcuts;
4169
+ }, {});
4170
+ function current() {
4171
+ const points = Object.keys(breakpoints).map((k) => [k, shortcutMethods[k], pxValue(getValue(k))]).sort((a, b) => a[2] - b[2]);
4172
+ return computed(() => points.filter(([, v]) => v.value).map(([k]) => k));
4173
+ }
4174
+ return Object.assign(shortcutMethods, {
4175
+ greaterOrEqual,
4176
+ smallerOrEqual,
4177
+ greater(k) {
4178
+ return useMediaQuery(() => `(min-width: ${getValue(k, 0.1)})`, options);
4179
+ },
4180
+ smaller(k) {
4181
+ return useMediaQuery(() => `(max-width: ${getValue(k, -0.1)})`, options);
4182
+ },
4183
+ between(a, b) {
4184
+ return useMediaQuery(() => `(min-width: ${getValue(a)}) and (max-width: ${getValue(b, -0.1)})`, options);
4185
+ },
4186
+ isGreater(k) {
4187
+ return match("min", getValue(k, 0.1));
4188
+ },
4189
+ isGreaterOrEqual(k) {
4190
+ return match("min", getValue(k));
4191
+ },
4192
+ isSmaller(k) {
4193
+ return match("max", getValue(k, -0.1));
4194
+ },
4195
+ isSmallerOrEqual(k) {
4196
+ return match("max", getValue(k));
4197
+ },
4198
+ isInBetween(a, b) {
4199
+ return match("min", getValue(a)) && match("max", getValue(b, -0.1));
4200
+ },
4201
+ current,
4202
+ active() {
4203
+ const bps = current();
4204
+ return computed(() => bps.value.length === 0 ? "" : bps.value.at(strategy === "min-width" ? -1 : 0));
4205
+ }
4206
+ });
4207
+ }
4208
+ const _hoisted_1$2 = {
4209
+ key: 0,
4210
+ class: "k-table-sider-layout k-table-sider-layout--collapse"
4211
+ };
4212
+ const _hoisted_2$2 = { class: "k-table-sider-layout__header" };
4213
+ const _hoisted_3$2 = { class: "k-table-sider-layout__title" };
4214
+ const _hoisted_4$1 = { class: "k-table-sider-layout__sider-body" };
4215
+ const _hoisted_5$1 = { class: "k-table-sider-layout__content" };
4216
+ const _hoisted_6 = { class: "k-table-sider-layout__sider" };
4217
+ const _hoisted_7 = { class: "k-table-sider-layout__header" };
4218
+ const _hoisted_8 = { class: "k-table-sider-layout__title" };
4219
+ const _hoisted_9 = { class: "k-table-sider-layout__extra" };
4220
+ const _hoisted_10 = { class: "k-table-sider-layout__sider-body" };
4221
+ const _hoisted_11 = { class: "k-table-sider-layout__content" };
4222
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4223
+ ...{ name: "KTableSiderLayout" },
4224
+ __name: "KTableSiderLayout",
4225
+ props: {
4226
+ siderTitle: {},
4227
+ defaultExpanded: { type: Boolean }
4228
+ },
4229
+ setup(__props) {
4230
+ const breakpoints = /* @__PURE__ */ useBreakpoints(breakpointsTailwind);
4231
+ const isCollapsed = breakpoints.smaller("lg");
4232
+ const collapseName = `k-table-sider-layout-${Date.now()}`;
4233
+ const isSiderCollapsed = ref(false);
4234
+ return (_ctx, _cache) => {
4235
+ const _component_el_collapse_item = resolveComponent("el-collapse-item");
4236
+ const _component_el_collapse = resolveComponent("el-collapse");
4237
+ const _component_el_icon = resolveComponent("el-icon");
4238
+ return unref(isCollapsed) ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
4239
+ createVNode(KCard, {
4240
+ class: "k-table-sider-layout__card",
4241
+ shadow: "never"
4242
+ }, {
4243
+ default: withCtx(() => [
4244
+ createVNode(_component_el_collapse, null, {
4245
+ default: withCtx(() => [
4246
+ createVNode(_component_el_collapse_item, { name: collapseName }, {
4247
+ title: withCtx(() => [
4248
+ createElementVNode("div", _hoisted_2$2, [
4249
+ createElementVNode("div", _hoisted_3$2, [
4250
+ renderSlot(_ctx.$slots, "header", {}, () => [
4251
+ createTextVNode(toDisplayString(_ctx.siderTitle), 1)
4252
+ ], true)
4253
+ ]),
4254
+ createElementVNode("div", {
4255
+ class: "k-table-sider-layout__extra",
4256
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {
4257
+ }, ["stop"]))
4258
+ }, [
4259
+ renderSlot(_ctx.$slots, "header-extra", {}, void 0, true)
4260
+ ])
4261
+ ])
4262
+ ]),
4263
+ default: withCtx(() => [
4264
+ createElementVNode("div", _hoisted_4$1, [
4265
+ renderSlot(_ctx.$slots, "sider", {}, void 0, true)
4266
+ ])
4267
+ ]),
4268
+ _: 3
4269
+ })
4270
+ ]),
4271
+ _: 3
4272
+ })
4273
+ ]),
4274
+ _: 3
4275
+ }),
4276
+ createElementVNode("main", _hoisted_5$1, [
4277
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
4278
+ ])
4279
+ ])) : (openBlock(), createElementBlock("div", {
4280
+ key: 1,
4281
+ class: normalizeClass([{ "k-table-sider-layout--sider-hidden": unref(isSiderCollapsed) }, "k-table-sider-layout"])
4282
+ }, [
4283
+ withDirectives(createElementVNode("div", _hoisted_6, [
4284
+ createVNode(KCard, {
4285
+ class: "k-table-sider-layout__card",
4286
+ shadow: "never"
4287
+ }, {
4288
+ header: withCtx(() => [
4289
+ createElementVNode("div", _hoisted_7, [
4290
+ createElementVNode("div", _hoisted_8, [
4291
+ renderSlot(_ctx.$slots, "header", {}, () => [
4292
+ createTextVNode(toDisplayString(_ctx.siderTitle), 1)
4293
+ ], true)
4294
+ ]),
4295
+ createElementVNode("div", _hoisted_9, [
4296
+ renderSlot(_ctx.$slots, "header-extra", {}, void 0, true)
4297
+ ])
4298
+ ])
4299
+ ]),
4300
+ default: withCtx(() => [
4301
+ createElementVNode("div", _hoisted_10, [
4302
+ renderSlot(_ctx.$slots, "sider", {}, void 0, true)
4303
+ ])
4304
+ ]),
4305
+ _: 3
4306
+ })
4307
+ ], 512), [
4308
+ [vShow, !unref(isSiderCollapsed)]
4309
+ ]),
4310
+ createElementVNode("button", {
4311
+ class: "k-table-sider-layout__toggle k-table-sider-layout__toggle--middle",
4312
+ type: "button",
4313
+ onClick: _cache[1] || (_cache[1] = ($event) => isSiderCollapsed.value = !unref(isSiderCollapsed))
4314
+ }, [
4315
+ unref(isSiderCollapsed) ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
4316
+ default: withCtx(() => [
4317
+ createVNode(unref(ArrowRight))
4318
+ ]),
4319
+ _: 1
4320
+ })) : (openBlock(), createBlock(_component_el_icon, { key: 1 }, {
4321
+ default: withCtx(() => [
4322
+ createVNode(unref(ArrowLeft))
4323
+ ]),
4324
+ _: 1
4325
+ }))
4326
+ ]),
4327
+ createElementVNode("main", _hoisted_11, [
4328
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
4329
+ ])
4330
+ ], 2));
4331
+ };
4332
+ }
4333
+ });
4334
+ const KTableSiderLayout = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-535bdadf"]]);
4335
+ const _hoisted_1$1 = { class: "setting-form" };
4336
+ const _hoisted_2$1 = { class: "form-content" };
4337
+ const _hoisted_3$1 = { class: "form-footer" };
4338
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4339
+ __name: "SettingForm",
4340
+ props: {
4341
+ title: { default: "" },
4342
+ formData: {},
4343
+ defaultData: { default: () => ({}) },
4344
+ rules: { default: () => ({}) },
4345
+ loading: { type: Boolean, default: false }
4346
+ },
4347
+ emits: ["save", "reset", "cancel", "reset-default"],
4348
+ setup(__props, { expose: __expose, emit: __emit }) {
4349
+ const props = __props;
4350
+ const emit = __emit;
4351
+ const formRef = ref();
4352
+ const isEditing = ref(false);
4353
+ const originalData = ref({});
4354
+ const handleEdit = () => {
4355
+ originalData.value = JSON.parse(JSON.stringify(props.formData));
4356
+ isEditing.value = true;
4357
+ };
4358
+ const handleSave = async () => {
4359
+ if (!formRef.value) return;
4360
+ await formRef.value.validate((valid) => {
4361
+ if (valid) {
4362
+ emit("save", props.formData);
4363
+ }
4364
+ });
4365
+ };
4366
+ const handleReset = () => {
4367
+ if (formRef.value) {
4368
+ formRef.value.resetFields();
4369
+ }
4370
+ emit("reset");
4371
+ };
4372
+ const handleCancel = () => {
4373
+ Object.assign(props.formData, originalData.value);
4374
+ isEditing.value = false;
4375
+ if (formRef.value) {
4376
+ formRef.value.clearValidate();
4377
+ }
4378
+ emit("cancel");
4379
+ };
4380
+ const handleResetToDefault = () => {
4381
+ emit("reset-default");
4382
+ };
4383
+ const exitEditMode = () => {
4384
+ isEditing.value = false;
4385
+ };
4386
+ __expose({
4387
+ exitEditMode
4388
+ });
4389
+ return (_ctx, _cache) => {
4390
+ const _component_el_form = resolveComponent("el-form");
4089
4391
  const _component_Edit = resolveComponent("Edit");
4090
4392
  const _component_el_icon = resolveComponent("el-icon");
4091
4393
  const _component_el_button = resolveComponent("el-button");
4092
4394
  const _component_RefreshLeft = resolveComponent("RefreshLeft");
4093
4395
  const _component_Check = resolveComponent("Check");
4094
4396
  const _component_Close = resolveComponent("Close");
4095
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
4096
- createElementVNode("div", _hoisted_2$4, [
4397
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
4398
+ createElementVNode("div", _hoisted_2$1, [
4097
4399
  createVNode(_component_el_form, {
4098
4400
  ref_key: "formRef",
4099
4401
  ref: formRef,
@@ -4112,7 +4414,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4112
4414
  _: 3
4113
4415
  }, 8, ["model", "rules", "disabled"])
4114
4416
  ]),
4115
- createElementVNode("div", _hoisted_3$3, [
4417
+ createElementVNode("div", _hoisted_3$1, [
4116
4418
  !unref(isEditing) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4117
4419
  createVNode(_component_el_button, {
4118
4420
  type: "primary",
@@ -4188,555 +4490,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4188
4490
  };
4189
4491
  }
4190
4492
  });
4191
- const SettingForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-3296eadc"]]);
4192
- function listConfig(query) {
4193
- return request({
4194
- url: "/system/config/list",
4195
- method: "get",
4196
- params: query
4197
- });
4198
- }
4199
- function updateConfigByKey(key, value) {
4200
- return request({
4201
- url: "/system/config/updateByKey",
4202
- method: "put",
4203
- data: {
4204
- configKey: key,
4205
- configValue: value
4206
- }
4207
- });
4208
- }
4209
- const _hoisted_1$3 = { class: "business-config-container" };
4210
- const _hoisted_2$3 = {
4211
- key: 3,
4212
- class: "form-item-tip"
4213
- };
4214
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
4215
- __name: "ModuleBusinessSettings",
4216
- props: {
4217
- category: {},
4218
- moduleLabel: {}
4219
- },
4220
- setup(__props) {
4221
- const props = __props;
4222
- const { proxy } = getCurrentInstance();
4223
- const settingFormRef = ref();
4224
- const loading = ref(false);
4225
- const moduleFieldMap = {
4226
- mall: [
4227
- { key: "orderAutoCancelMinutes", label: "订单自动取消分钟", control: "number", min: 0, max: 10080, tip: "0 表示不自动取消" },
4228
- { key: "afterSaleDays", label: "售后申请天数", control: "number", min: 0, max: 365 },
4229
- { key: "minOrderAmount", label: "最低下单金额", control: "number", min: 0, max: 999999, precision: 2 },
4230
- { key: "buyButtonText", label: "购买按钮文案", placeholder: "请输入购买按钮文案", maxlength: 20 }
4231
- ],
4232
- im: [
4233
- { key: "friendRequestNeedVerify", label: "添加好友需验证", control: "switch" },
4234
- { key: "messageRecallMinutes", label: "消息撤回时限分钟", control: "number", min: 0, max: 1440, tip: "0 表示不可撤回" },
4235
- { key: "groupCreateEnabled", label: "允许创建群聊", control: "switch" },
4236
- { key: "maxFileSizeMb", label: "附件大小上限(MB)", control: "number", min: 1, max: 1024 }
4237
- ],
4238
- exam: [
4239
- { key: "practiceEnabled", label: "开启练习模式", control: "switch" },
4240
- { key: "showAnswerAfterSubmit", label: "交卷后显示答案", control: "switch" },
4241
- { key: "defaultDurationMinutes", label: "默认考试时长(分钟)", control: "number", min: 0, max: 1440 },
4242
- { key: "maxRetakeCount", label: "最大补考次数", control: "number", min: 0, max: 99 }
4243
- ],
4244
- gallery: [
4245
- { key: "uploadEnabled", label: "允许上传", control: "switch" },
4246
- { key: "reviewBeforePublish", label: "发布前需审核", control: "switch" },
4247
- { key: "maxUploadSizeMb", label: "单文件大小上限(MB)", control: "number", min: 1, max: 500 },
4248
- { key: "dailyUploadCountLimit", label: "用户日上传数量上限", control: "number", min: 0, max: 1e5, tip: "0 表示不限制" },
4249
- { key: "dailyUploadSizeLimitMb", label: "用户日上传容量上限(MB)", control: "number", min: 0, max: 1e6, tip: "0 表示不限制" }
4250
- ]
4251
- };
4252
- const moduleFields = computed(() => moduleFieldMap[props.category]);
4253
- const fieldKeys = computed(() => moduleFields.value.map((item) => item.key));
4254
- function createFieldState() {
4255
- return fieldKeys.value.reduce(
4256
- (result, key) => {
4257
- result[key] = "";
4258
- return result;
4259
- },
4260
- {}
4261
- );
4262
- }
4263
- const formData = reactive(createFieldState());
4264
- const originalData = reactive(createFieldState());
4265
- const defaultData = reactive(createFieldState());
4266
- const rules = {};
4267
- const configKeyMap = {
4268
- orderAutoCancelMinutes: "mall.orderAutoCancelMinutes",
4269
- afterSaleDays: "mall.afterSaleDays",
4270
- minOrderAmount: "mall.minOrderAmount",
4271
- buyButtonText: "mall.buyButtonText",
4272
- friendRequestNeedVerify: "im.friendRequestNeedVerify",
4273
- messageRecallMinutes: "im.messageRecallMinutes",
4274
- groupCreateEnabled: "im.groupCreateEnabled",
4275
- maxFileSizeMb: "im.maxFileSizeMb",
4276
- practiceEnabled: "exam.practiceEnabled",
4277
- showAnswerAfterSubmit: "exam.showAnswerAfterSubmit",
4278
- defaultDurationMinutes: "exam.defaultDurationMinutes",
4279
- maxRetakeCount: "exam.maxRetakeCount",
4280
- uploadEnabled: "gallery.uploadEnabled",
4281
- reviewBeforePublish: "gallery.reviewBeforePublish",
4282
- maxUploadSizeMb: "gallery.maxUploadSizeMb",
4283
- dailyUploadCountLimit: "gallery.dailyUploadCountLimit",
4284
- dailyUploadSizeLimitMb: "gallery.dailyUploadSizeLimitMb"
4285
- };
4286
- const reverseKeyMap = Object.entries(configKeyMap).reduce(
4287
- (result, [field, key]) => {
4288
- result[key] = field;
4289
- return result;
4290
- },
4291
- {}
4292
- );
4293
- const numberFieldSet = /* @__PURE__ */ new Set([
4294
- "orderAutoCancelMinutes",
4295
- "afterSaleDays",
4296
- "minOrderAmount",
4297
- "messageRecallMinutes",
4298
- "maxFileSizeMb",
4299
- "defaultDurationMinutes",
4300
- "maxRetakeCount",
4301
- "maxUploadSizeMb",
4302
- "dailyUploadCountLimit",
4303
- "dailyUploadSizeLimitMb"
4304
- ]);
4305
- function normalizeValue(field, value) {
4306
- if (numberFieldSet.has(field)) {
4307
- if (value === "" || value === null || value === void 0) return 0;
4308
- const parsed = Number(value);
4309
- return Number.isNaN(parsed) ? 0 : parsed;
4310
- }
4311
- return value ?? "";
4312
- }
4313
- function stringifyValue(field, value) {
4314
- if (numberFieldSet.has(field)) {
4315
- return String(value ?? 0);
4316
- }
4317
- return String(value ?? "");
4318
- }
4319
- async function loadConfig() {
4320
- loading.value = true;
4321
- try {
4322
- const res = await listConfig({
4323
- pageNum: 1,
4324
- pageSize: 100,
4325
- configCategory: props.category
4326
- });
4327
- fieldKeys.value.forEach((key) => {
4328
- formData[key] = normalizeValue(key, "");
4329
- originalData[key] = normalizeValue(key, "");
4330
- defaultData[key] = normalizeValue(key, "");
4331
- });
4332
- (res.rows || []).forEach((item) => {
4333
- const field = reverseKeyMap[item.configKey];
4334
- if (!field) return;
4335
- formData[field] = normalizeValue(field, item.configValue);
4336
- originalData[field] = normalizeValue(field, item.configValue);
4337
- defaultData[field] = normalizeValue(field, item.defaultValue);
4338
- });
4339
- } finally {
4340
- loading.value = false;
4341
- }
4342
- }
4343
- async function handleSave() {
4344
- var _a, _b, _c, _d;
4345
- loading.value = true;
4346
- try {
4347
- const changedKeys = fieldKeys.value.filter((key) => stringifyValue(key, formData[key]) !== stringifyValue(key, originalData[key]));
4348
- if (!changedKeys.length) {
4349
- proxy == null ? void 0 : proxy.$modal.msg("未检测到变更");
4350
- (_b = (_a = settingFormRef.value) == null ? void 0 : _a.exitEditMode) == null ? void 0 : _b.call(_a);
4351
- return;
4352
- }
4353
- for (const key of changedKeys) {
4354
- await updateConfigByKey(configKeyMap[key], stringifyValue(key, formData[key]));
4355
- originalData[key] = normalizeValue(key, formData[key]);
4356
- }
4357
- proxy == null ? void 0 : proxy.$modal.msgSuccess(`已保存 ${changedKeys.length} 项配置`);
4358
- (_d = (_c = settingFormRef.value) == null ? void 0 : _c.exitEditMode) == null ? void 0 : _d.call(_c);
4359
- } catch (error) {
4360
- console.error(`save ${props.category} business config failed`, error);
4361
- proxy == null ? void 0 : proxy.$modal.msgError("保存失败");
4362
- } finally {
4363
- loading.value = false;
4364
- }
4365
- }
4366
- function handleReset() {
4367
- loadConfig();
4368
- }
4369
- function handleCancel() {
4370
- }
4371
- function handleResetToDefault() {
4372
- proxy == null ? void 0 : proxy.$modal.confirm("确认恢复默认值吗?").then(() => {
4373
- fieldKeys.value.forEach((key) => {
4374
- formData[key] = normalizeValue(key, defaultData[key]);
4375
- });
4376
- proxy == null ? void 0 : proxy.$modal.msgSuccess("已恢复默认值,保存后生效。");
4377
- }).catch(() => {
4378
- });
4379
- }
4380
- onMounted(() => {
4381
- loadConfig();
4382
- });
4383
- return (_ctx, _cache) => {
4384
- const _component_el_switch = resolveComponent("el-switch");
4385
- const _component_el_input_number = resolveComponent("el-input-number");
4386
- const _component_el_input = resolveComponent("el-input");
4387
- const _component_el_form_item = resolveComponent("el-form-item");
4388
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
4389
- createVNode(SettingForm, {
4390
- ref_key: "settingFormRef",
4391
- ref: settingFormRef,
4392
- "default-data": defaultData,
4393
- "form-data": formData,
4394
- loading: loading.value,
4395
- rules,
4396
- title: `${_ctx.moduleLabel}业务配置`,
4397
- onCancel: handleCancel,
4398
- onReset: handleReset,
4399
- onSave: handleSave,
4400
- onResetDefault: handleResetToDefault
4401
- }, {
4402
- default: withCtx(({ isEditing }) => [
4403
- (openBlock(true), createElementBlock(Fragment, null, renderList(moduleFields.value, (field) => {
4404
- return openBlock(), createBlock(_component_el_form_item, {
4405
- key: field.key,
4406
- label: field.label,
4407
- prop: field.key
4408
- }, {
4409
- default: withCtx(() => [
4410
- field.control === "switch" ? (openBlock(), createBlock(_component_el_switch, {
4411
- key: 0,
4412
- modelValue: formData[field.key],
4413
- "onUpdate:modelValue": ($event) => formData[field.key] = $event,
4414
- "active-value": "true",
4415
- "inactive-value": "false",
4416
- disabled: !isEditing
4417
- }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"])) : field.control === "number" ? (openBlock(), createBlock(_component_el_input_number, {
4418
- key: 1,
4419
- modelValue: formData[field.key],
4420
- "onUpdate:modelValue": ($event) => formData[field.key] = $event,
4421
- disabled: !isEditing,
4422
- min: field.min,
4423
- max: field.max,
4424
- precision: field.precision,
4425
- class: "w-full"
4426
- }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "min", "max", "precision"])) : (openBlock(), createBlock(_component_el_input, {
4427
- key: 2,
4428
- modelValue: formData[field.key],
4429
- "onUpdate:modelValue": ($event) => formData[field.key] = $event,
4430
- maxlength: field.maxlength,
4431
- placeholder: field.placeholder,
4432
- rows: field.rows,
4433
- "show-word-limit": field.type === "textarea",
4434
- type: field.type || "text",
4435
- clearable: ""
4436
- }, null, 8, ["modelValue", "onUpdate:modelValue", "maxlength", "placeholder", "rows", "show-word-limit", "type"])),
4437
- field.tip ? (openBlock(), createElementBlock("div", _hoisted_2$3, toDisplayString(field.tip), 1)) : createCommentVNode("", true)
4438
- ]),
4439
- _: 2
4440
- }, 1032, ["label", "prop"]);
4441
- }), 128))
4442
- ]),
4443
- _: 1
4444
- }, 8, ["default-data", "form-data", "loading", "title"])
4445
- ]);
4446
- };
4447
- }
4448
- });
4449
- const ModuleBusinessSettings = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-1df6b0cb"]]);
4450
- const _hoisted_1$2 = { class: "website-config-container" };
4451
- const _hoisted_2$2 = { class: "form-section" };
4452
- const _hoisted_3$2 = { class: "preview-section" };
4453
- const _hoisted_4$2 = { class: "preview-container" };
4454
- const _hoisted_5$2 = { class: "preview-header" };
4455
- const _hoisted_6$1 = ["src"];
4456
- const _hoisted_7$1 = {
4457
- key: 1,
4458
- class: "text-gray-400"
4459
- };
4460
- const _hoisted_8 = { class: "preview-content" };
4461
- const _hoisted_9 = { class: "preview-name" };
4462
- const _hoisted_10 = { class: "preview-desc" };
4463
- const _hoisted_11 = {
4464
- key: 0,
4465
- class: "preview-meta"
4466
- };
4467
- const _hoisted_12 = { key: 0 };
4468
- const _hoisted_13 = { key: 1 };
4469
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4470
- __name: "ModuleWebsiteSettings",
4471
- props: {
4472
- category: {},
4473
- moduleLabel: {}
4474
- },
4475
- setup(__props) {
4476
- const props = __props;
4477
- const { proxy } = getCurrentInstance();
4478
- const settingFormRef = ref();
4479
- const loading = ref(false);
4480
- const logoUrl = ref("");
4481
- const baseFields = [
4482
- { key: "name", label: "系统名称", placeholder: "请输入系统名称", maxlength: 50 },
4483
- { key: "nameEn", label: "英文名称", placeholder: "请输入英文名称", maxlength: 50 },
4484
- { key: "description", label: "站点描述", placeholder: "请输入站点描述", maxlength: 200, type: "textarea", rows: 3 },
4485
- { key: "copyright", label: "版权信息", placeholder: "请输入版权信息", maxlength: 200, type: "textarea", rows: 2 },
4486
- { key: "icp", label: "ICP备案号", placeholder: "请输入 ICP 备案号", maxlength: 50 }
4487
- ];
4488
- const fieldKeys = computed(() => ["logo", "favicon", "backgroundImage", ...baseFields.map((item) => item.key)]);
4489
- function createFieldState() {
4490
- return fieldKeys.value.reduce(
4491
- (result, key) => {
4492
- result[key] = "";
4493
- return result;
4494
- },
4495
- {}
4496
- );
4497
- }
4498
- const formData = reactive(createFieldState());
4499
- const originalData = reactive(createFieldState());
4500
- const defaultData = reactive(createFieldState());
4501
- const rules = {
4502
- name: [{ required: true, message: "请输入系统名称", trigger: "blur" }],
4503
- copyright: [{ required: true, message: "请输入版权信息", trigger: "blur" }]
4504
- };
4505
- const configKeyMap = computed(() => ({
4506
- logo: `${props.category}.logo`,
4507
- favicon: `${props.category}.favicon`,
4508
- name: `${props.category}.name`,
4509
- nameEn: `${props.category}.nameEn`,
4510
- backgroundImage: `${props.category}.backgroundImage`,
4511
- description: `${props.category}.description`,
4512
- copyright: `${props.category}.copyright`,
4513
- icp: `${props.category}.icp`
4514
- }));
4515
- const reverseKeyMap = computed(
4516
- () => Object.entries(configKeyMap.value).reduce(
4517
- (result, [field, key]) => {
4518
- result[key] = field;
4519
- return result;
4520
- },
4521
- {}
4522
- )
4523
- );
4524
- async function getImageUrl(value) {
4525
- var _a, _b;
4526
- if (!value) return "";
4527
- if (value.startsWith("http")) return value;
4528
- try {
4529
- const { listByIds: listByIds2 } = await Promise.resolve().then(() => oss);
4530
- const res = await listByIds2(value);
4531
- return ((_b = (_a = res.data) == null ? void 0 : _a[0]) == null ? void 0 : _b.url) || "";
4532
- } catch {
4533
- return "";
4534
- }
4535
- }
4536
- async function syncPreview() {
4537
- logoUrl.value = await getImageUrl(String(formData.logo || ""));
4538
- }
4539
- async function loadConfig() {
4540
- loading.value = true;
4541
- try {
4542
- const res = await listConfig({
4543
- pageNum: 1,
4544
- pageSize: 100,
4545
- configCategory: props.category
4546
- });
4547
- fieldKeys.value.forEach((key) => {
4548
- formData[key] = "";
4549
- originalData[key] = "";
4550
- defaultData[key] = "";
4551
- });
4552
- (res.rows || []).forEach((item) => {
4553
- const field = reverseKeyMap.value[item.configKey];
4554
- if (!field) return;
4555
- formData[field] = item.configValue || "";
4556
- originalData[field] = item.configValue || "";
4557
- defaultData[field] = item.defaultValue || "";
4558
- });
4559
- await syncPreview();
4560
- } finally {
4561
- loading.value = false;
4562
- }
4563
- }
4564
- function handleLogoUpload(data) {
4565
- formData.logo = String(data.ossId || "");
4566
- logoUrl.value = data.url || "";
4567
- }
4568
- function handleFaviconUpload(data) {
4569
- formData.favicon = String(data.ossId || "");
4570
- }
4571
- function handleBackgroundImageUpload(data) {
4572
- formData.backgroundImage = String(data.ossId || "");
4573
- }
4574
- async function handleSave() {
4575
- var _a, _b, _c, _d;
4576
- loading.value = true;
4577
- try {
4578
- const changedKeys = fieldKeys.value.filter((key) => formData[key] !== originalData[key]);
4579
- if (!changedKeys.length) {
4580
- proxy == null ? void 0 : proxy.$modal.msg("未检测到变更");
4581
- (_b = (_a = settingFormRef.value) == null ? void 0 : _a.exitEditMode) == null ? void 0 : _b.call(_a);
4582
- return;
4583
- }
4584
- for (const key of changedKeys) {
4585
- await updateConfigByKey(configKeyMap.value[key], formData[key]);
4586
- originalData[key] = formData[key];
4587
- }
4588
- proxy == null ? void 0 : proxy.$modal.msgSuccess(`已保存 ${changedKeys.length} 项配置`);
4589
- (_d = (_c = settingFormRef.value) == null ? void 0 : _c.exitEditMode) == null ? void 0 : _d.call(_c);
4590
- await syncPreview();
4591
- } catch (error) {
4592
- console.error(`save ${props.category} website config failed`, error);
4593
- proxy == null ? void 0 : proxy.$modal.msgError("保存失败");
4594
- } finally {
4595
- loading.value = false;
4596
- }
4597
- }
4598
- function handleReset() {
4599
- loadConfig();
4600
- }
4601
- function handleCancel() {
4602
- }
4603
- function handleResetToDefault() {
4604
- proxy == null ? void 0 : proxy.$modal.confirm("确认恢复默认值吗?").then(() => {
4605
- Object.assign(formData, defaultData);
4606
- proxy == null ? void 0 : proxy.$modal.msgSuccess("已恢复默认值,保存后生效。");
4607
- }).catch(() => {
4608
- });
4609
- }
4610
- onMounted(() => {
4611
- loadConfig();
4612
- });
4613
- return (_ctx, _cache) => {
4614
- const _component_el_form_item = resolveComponent("el-form-item");
4615
- const _component_el_input = resolveComponent("el-input");
4616
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
4617
- createElementVNode("div", _hoisted_2$2, [
4618
- createVNode(SettingForm, {
4619
- ref_key: "settingFormRef",
4620
- ref: settingFormRef,
4621
- "default-data": defaultData,
4622
- "form-data": formData,
4623
- loading: loading.value,
4624
- rules,
4625
- title: `${_ctx.moduleLabel}网站配置`,
4626
- onCancel: handleCancel,
4627
- onReset: handleReset,
4628
- onSave: handleSave,
4629
- onResetDefault: handleResetToDefault
4630
- }, {
4631
- default: withCtx(({ isEditing }) => [
4632
- createVNode(_component_el_form_item, {
4633
- label: "系统 Logo",
4634
- prop: "logo"
4635
- }, {
4636
- default: withCtx(() => [
4637
- createVNode(ImageUpload, {
4638
- modelValue: formData.logo,
4639
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.logo = $event),
4640
- disabled: !isEditing,
4641
- "file-size": 2,
4642
- "file-type": ["png", "jpg", "jpeg", "svg"],
4643
- limit: 1,
4644
- onUploadSuccess: handleLogoUpload
4645
- }, null, 8, ["modelValue", "disabled"])
4646
- ]),
4647
- _: 2
4648
- }, 1024),
4649
- createVNode(_component_el_form_item, {
4650
- label: "系统图标",
4651
- prop: "favicon"
4652
- }, {
4653
- default: withCtx(() => [
4654
- createVNode(ImageUpload, {
4655
- modelValue: formData.favicon,
4656
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => formData.favicon = $event),
4657
- disabled: !isEditing,
4658
- "file-size": 2,
4659
- "file-type": ["png", "jpg", "jpeg", "ico"],
4660
- limit: 1,
4661
- onUploadSuccess: handleFaviconUpload
4662
- }, null, 8, ["modelValue", "disabled"])
4663
- ]),
4664
- _: 2
4665
- }, 1024),
4666
- createVNode(_component_el_form_item, {
4667
- label: "背景图",
4668
- prop: "backgroundImage"
4669
- }, {
4670
- default: withCtx(() => [
4671
- createVNode(ImageUpload, {
4672
- modelValue: formData.backgroundImage,
4673
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => formData.backgroundImage = $event),
4674
- disabled: !isEditing,
4675
- "file-size": 5,
4676
- "file-type": ["png", "jpg", "jpeg", "webp"],
4677
- limit: 1,
4678
- onUploadSuccess: handleBackgroundImageUpload
4679
- }, null, 8, ["modelValue", "disabled"])
4680
- ]),
4681
- _: 2
4682
- }, 1024),
4683
- (openBlock(), createElementBlock(Fragment, null, renderList(baseFields, (field) => {
4684
- return createVNode(_component_el_form_item, {
4685
- key: field.key,
4686
- label: field.label,
4687
- prop: field.key
4688
- }, {
4689
- default: withCtx(() => [
4690
- createVNode(_component_el_input, {
4691
- modelValue: formData[field.key],
4692
- "onUpdate:modelValue": ($event) => formData[field.key] = $event,
4693
- maxlength: field.maxlength,
4694
- placeholder: field.placeholder,
4695
- rows: field.rows,
4696
- "show-word-limit": field.type === "textarea",
4697
- type: field.type || "text",
4698
- clearable: ""
4699
- }, null, 8, ["modelValue", "onUpdate:modelValue", "maxlength", "placeholder", "rows", "show-word-limit", "type"])
4700
- ]),
4701
- _: 2
4702
- }, 1032, ["label", "prop"]);
4703
- }), 64))
4704
- ]),
4705
- _: 1
4706
- }, 8, ["default-data", "form-data", "loading", "title"])
4707
- ]),
4708
- createElementVNode("div", _hoisted_3$2, [
4709
- _cache[3] || (_cache[3] = createElementVNode("div", { class: "preview-title" }, "预览效果", -1)),
4710
- createElementVNode("div", _hoisted_4$2, [
4711
- createElementVNode("div", _hoisted_5$2, [
4712
- logoUrl.value ? (openBlock(), createElementBlock("img", {
4713
- key: 0,
4714
- src: logoUrl.value,
4715
- alt: "logo",
4716
- class: "preview-logo"
4717
- }, null, 8, _hoisted_6$1)) : (openBlock(), createElementBlock("span", _hoisted_7$1, "未上传 Logo"))
4718
- ]),
4719
- createElementVNode("div", _hoisted_8, [
4720
- createElementVNode("h2", _hoisted_9, toDisplayString(formData.name || `${_ctx.moduleLabel}名称`), 1),
4721
- createElementVNode("p", _hoisted_10, toDisplayString(formData.description || `${_ctx.moduleLabel}描述`), 1),
4722
- formData.copyright || formData.icp ? (openBlock(), createElementBlock("div", _hoisted_11, [
4723
- formData.copyright ? (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString(formData.copyright), 1)) : createCommentVNode("", true),
4724
- formData.icp ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(formData.icp), 1)) : createCommentVNode("", true)
4725
- ])) : createCommentVNode("", true)
4726
- ])
4727
- ])
4728
- ])
4729
- ]);
4730
- };
4731
- }
4732
- });
4733
- const ModuleWebsiteSettings = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d11a083d"]]);
4734
- const _hoisted_1$1 = { class: "setting-tabs" };
4735
- const _hoisted_2$1 = { class: "tabs-sidebar" };
4736
- const _hoisted_3$1 = ["onClick"];
4737
- const _hoisted_4$1 = { class: "tab-label" };
4738
- const _hoisted_5$1 = { class: "tabs-content" };
4739
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4493
+ const SettingForm = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4c55aa01"]]);
4494
+ const _hoisted_1 = { class: "setting-tabs" };
4495
+ const _hoisted_2 = { class: "tabs-sidebar" };
4496
+ const _hoisted_3 = ["onClick"];
4497
+ const _hoisted_4 = { class: "tab-label" };
4498
+ const _hoisted_5 = { class: "tabs-content" };
4499
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4740
4500
  __name: "SettingTabs",
4741
4501
  props: {
4742
4502
  modelValue: {},
@@ -4750,8 +4510,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4750
4510
  };
4751
4511
  return (_ctx, _cache) => {
4752
4512
  const _component_el_icon = resolveComponent("el-icon");
4753
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
4754
- createElementVNode("div", _hoisted_2$1, [
4513
+ return openBlock(), createElementBlock("div", _hoisted_1, [
4514
+ createElementVNode("div", _hoisted_2, [
4755
4515
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.tabs, (tab) => {
4756
4516
  return openBlock(), createElementBlock("div", {
4757
4517
  key: tab.name,
@@ -4764,286 +4524,54 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4764
4524
  ]),
4765
4525
  _: 2
4766
4526
  }, 1024),
4767
- createElementVNode("span", _hoisted_4$1, toDisplayString(tab.label), 1)
4768
- ], 10, _hoisted_3$1);
4527
+ createElementVNode("span", _hoisted_4, toDisplayString(tab.label), 1)
4528
+ ], 10, _hoisted_3);
4769
4529
  }), 128))
4770
4530
  ]),
4771
- createElementVNode("div", _hoisted_5$1, [
4531
+ createElementVNode("div", _hoisted_5, [
4772
4532
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
4773
4533
  ])
4774
4534
  ]);
4775
4535
  };
4776
4536
  }
4777
4537
  });
4778
- const SettingTabs = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-97bf5366"]]);
4779
- function getUser(userId) {
4780
- return request({
4781
- url: "/system/user/" + (userId ?? ""),
4782
- method: "get"
4783
- });
4784
- }
4785
- const UNBOUND_CONTACT_VALUES = /* @__PURE__ */ new Set(["", "-1", "null", "undefined"]);
4786
- function normalizeContactValue(value) {
4787
- return `${value ?? ""}`.trim();
4788
- }
4789
- function isContactBound(value) {
4790
- return !UNBOUND_CONTACT_VALUES.has(normalizeContactValue(value).toLowerCase());
4791
- }
4792
- function sanitizeContactValue(value) {
4793
- return isContactBound(value) ? normalizeContactValue(value) : "";
4794
- }
4795
- function formatContactDisplay(value, fallback = "未绑定") {
4796
- return sanitizeContactValue(value) || fallback;
4538
+ const SettingTabs = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a03c2629"]]);
4539
+ function hostOnlyComponent(name) {
4540
+ return {
4541
+ name,
4542
+ render() {
4543
+ throw new Error(`[wujies] ${name} 的实例只由宿主提供:请确认构建时 @wujies/components 是 external`);
4544
+ }
4545
+ };
4797
4546
  }
4798
- const _hoisted_1 = { class: "user-detail-container" };
4799
- const _hoisted_2 = {
4800
- key: 1,
4801
- class: "detail-content"
4802
- };
4803
- const _hoisted_3 = { class: "user-avatar" };
4804
- const _hoisted_4 = { class: "user-info" };
4805
- const _hoisted_5 = { key: 2 };
4806
- const _hoisted_6 = {
4807
- key: 0,
4808
- class: "roles-container"
4809
- };
4810
- const _hoisted_7 = { key: 1 };
4811
- const _sfc_main = /* @__PURE__ */ defineComponent({
4812
- __name: "UserDetail",
4813
- props: {
4814
- modelValue: { type: Boolean },
4815
- userId: {}
4816
- },
4817
- emits: ["update:modelValue"],
4818
- setup(__props, { emit: __emit }) {
4819
- const props = __props;
4820
- const emit = __emit;
4821
- const visible = ref(false);
4822
- const loading = ref(false);
4823
- const userData = ref(null);
4824
- watch(
4825
- () => props.modelValue,
4826
- (val) => {
4827
- visible.value = val;
4828
- if (val && props.userId) {
4829
- loadUserDetail();
4830
- }
4831
- }
4832
- );
4833
- watch(visible, (val) => {
4834
- emit("update:modelValue", val);
4835
- });
4836
- const loadUserDetail = async () => {
4837
- if (!props.userId) return;
4838
- loading.value = true;
4839
- try {
4840
- const res = await getUser(props.userId);
4841
- if (res.code === 200) {
4842
- userData.value = res.data.user;
4843
- }
4844
- } catch (error) {
4845
- console.error("加载用户详情失败:", error);
4846
- } finally {
4847
- loading.value = false;
4848
- }
4849
- };
4850
- const handleClose = () => {
4851
- userData.value = null;
4852
- };
4853
- return (_ctx, _cache) => {
4854
- const _component_el_empty = resolveComponent("el-empty");
4855
- const _component_el_icon = resolveComponent("el-icon");
4856
- const _component_el_avatar = resolveComponent("el-avatar");
4857
- const _component_el_descriptions_item = resolveComponent("el-descriptions-item");
4858
- const _component_el_tag = resolveComponent("el-tag");
4859
- const _component_el_descriptions = resolveComponent("el-descriptions");
4860
- const _component_el_dialog = resolveComponent("el-dialog");
4861
- const _directive_loading = resolveDirective("loading");
4862
- return openBlock(), createBlock(_component_el_dialog, {
4863
- modelValue: visible.value,
4864
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
4865
- title: "用户详情",
4866
- width: "600px",
4867
- onClose: handleClose
4868
- }, {
4869
- default: withCtx(() => [
4870
- withDirectives((openBlock(), createElementBlock("div", _hoisted_1, [
4871
- !userData.value ? (openBlock(), createBlock(_component_el_empty, {
4872
- key: 0,
4873
- description: "用户不存在"
4874
- })) : (openBlock(), createElementBlock("div", _hoisted_2, [
4875
- createElementVNode("div", _hoisted_3, [
4876
- createVNode(_component_el_avatar, {
4877
- size: 80,
4878
- src: userData.value.avatar
4879
- }, {
4880
- default: withCtx(() => [
4881
- createVNode(_component_el_icon, { size: 40 }, {
4882
- default: withCtx(() => [
4883
- createVNode(unref(User))
4884
- ]),
4885
- _: 1
4886
- })
4887
- ]),
4888
- _: 1
4889
- }, 8, ["src"])
4890
- ]),
4891
- createElementVNode("div", _hoisted_4, [
4892
- createVNode(_component_el_descriptions, {
4893
- column: 1,
4894
- border: ""
4895
- }, {
4896
- default: withCtx(() => [
4897
- createVNode(_component_el_descriptions_item, { label: "用户ID" }, {
4898
- default: withCtx(() => [
4899
- createTextVNode(toDisplayString(userData.value.userId), 1)
4900
- ]),
4901
- _: 1
4902
- }),
4903
- createVNode(_component_el_descriptions_item, { label: "用户名" }, {
4904
- default: withCtx(() => [
4905
- createTextVNode(toDisplayString(userData.value.userName || "-"), 1)
4906
- ]),
4907
- _: 1
4908
- }),
4909
- createVNode(_component_el_descriptions_item, { label: "昵称" }, {
4910
- default: withCtx(() => [
4911
- createTextVNode(toDisplayString(userData.value.nickName || "-"), 1)
4912
- ]),
4913
- _: 1
4914
- }),
4915
- createVNode(_component_el_descriptions_item, { label: "邮箱" }, {
4916
- default: withCtx(() => [
4917
- createTextVNode(toDisplayString(unref(formatContactDisplay)(userData.value.email)), 1)
4918
- ]),
4919
- _: 1
4920
- }),
4921
- createVNode(_component_el_descriptions_item, { label: "手机号" }, {
4922
- default: withCtx(() => [
4923
- createTextVNode(toDisplayString(unref(formatContactDisplay)(userData.value.phonenumber)), 1)
4924
- ]),
4925
- _: 1
4926
- }),
4927
- createVNode(_component_el_descriptions_item, { label: "性别" }, {
4928
- default: withCtx(() => [
4929
- userData.value.sex === "0" ? (openBlock(), createBlock(_component_el_tag, {
4930
- key: 0,
4931
- size: "small",
4932
- type: "info"
4933
- }, {
4934
- default: withCtx(() => _cache[1] || (_cache[1] = [
4935
- createTextVNode("男")
4936
- ])),
4937
- _: 1
4938
- })) : userData.value.sex === "1" ? (openBlock(), createBlock(_component_el_tag, {
4939
- key: 1,
4940
- size: "small",
4941
- type: "warning"
4942
- }, {
4943
- default: withCtx(() => _cache[2] || (_cache[2] = [
4944
- createTextVNode("女")
4945
- ])),
4946
- _: 1
4947
- })) : (openBlock(), createElementBlock("span", _hoisted_5, "-"))
4948
- ]),
4949
- _: 1
4950
- }),
4951
- createVNode(_component_el_descriptions_item, { label: "部门" }, {
4952
- default: withCtx(() => {
4953
- var _a;
4954
- return [
4955
- createTextVNode(toDisplayString(((_a = userData.value.dept) == null ? void 0 : _a.deptName) || "-"), 1)
4956
- ];
4957
- }),
4958
- _: 1
4959
- }),
4960
- createVNode(_component_el_descriptions_item, { label: "角色" }, {
4961
- default: withCtx(() => [
4962
- userData.value.roles && userData.value.roles.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_6, [
4963
- (openBlock(true), createElementBlock(Fragment, null, renderList(userData.value.roles, (role) => {
4964
- return openBlock(), createBlock(_component_el_tag, {
4965
- key: role.roleId,
4966
- class: "mr-1",
4967
- size: "small",
4968
- type: "success"
4969
- }, {
4970
- default: withCtx(() => [
4971
- createTextVNode(toDisplayString(role.roleName), 1)
4972
- ]),
4973
- _: 2
4974
- }, 1024);
4975
- }), 128))
4976
- ])) : (openBlock(), createElementBlock("span", _hoisted_7, "-"))
4977
- ]),
4978
- _: 1
4979
- }),
4980
- createVNode(_component_el_descriptions_item, { label: "状态" }, {
4981
- default: withCtx(() => [
4982
- createVNode(_component_el_tag, {
4983
- type: userData.value.status === "0" ? "success" : "danger",
4984
- size: "small"
4985
- }, {
4986
- default: withCtx(() => [
4987
- createTextVNode(toDisplayString(userData.value.status === "0" ? "正常" : "停用"), 1)
4988
- ]),
4989
- _: 1
4990
- }, 8, ["type"])
4991
- ]),
4992
- _: 1
4993
- }),
4994
- createVNode(_component_el_descriptions_item, { label: "创建时间" }, {
4995
- default: withCtx(() => [
4996
- createTextVNode(toDisplayString(userData.value.createTime || "-"), 1)
4997
- ]),
4998
- _: 1
4999
- }),
5000
- createVNode(_component_el_descriptions_item, { label: "最后登录时间" }, {
5001
- default: withCtx(() => [
5002
- createTextVNode(toDisplayString(userData.value.loginDate || "-"), 1)
5003
- ]),
5004
- _: 1
5005
- }),
5006
- createVNode(_component_el_descriptions_item, { label: "最后登录IP" }, {
5007
- default: withCtx(() => [
5008
- createTextVNode(toDisplayString(userData.value.loginIp || "-"), 1)
5009
- ]),
5010
- _: 1
5011
- }),
5012
- createVNode(_component_el_descriptions_item, { label: "登录地点" }, {
5013
- default: withCtx(() => [
5014
- createTextVNode(toDisplayString(userData.value.loginLocation || "-"), 1)
5015
- ]),
5016
- _: 1
5017
- })
5018
- ]),
5019
- _: 1
5020
- })
5021
- ])
5022
- ]))
5023
- ])), [
5024
- [_directive_loading, loading.value]
5025
- ])
5026
- ]),
5027
- _: 1
5028
- }, 8, ["modelValue"]);
5029
- };
5030
- }
5031
- });
5032
- const UserDetail = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c0cb0304"]]);
4547
+ const ImageUpload = hostOnlyComponent("ImageUpload");
4548
+ const ModuleBusinessSettings = hostOnlyComponent("ModuleBusinessSettings");
4549
+ const ModuleWebsiteSettings = hostOnlyComponent("ModuleWebsiteSettings");
4550
+ const UserDetail = hostOnlyComponent("UserDetail");
5033
4551
  export {
5034
4552
  ImagePreview,
5035
4553
  ImageUpload,
5036
4554
  KCard,
4555
+ KCustomTabs,
5037
4556
  KDictTag,
5038
- _sfc_main$9 as KPlainButton,
4557
+ KIpSegmentInput,
4558
+ KPagination,
4559
+ _sfc_main$b as KPlainButton,
4560
+ KRightToolbar,
5039
4561
  KSearchBar,
4562
+ KSectionTitle,
4563
+ KSegmented,
5040
4564
  KSelectedAlert,
4565
+ KSpin,
5041
4566
  KTable,
5042
4567
  KTableHeader,
4568
+ KTableSiderLayout,
5043
4569
  ModuleBusinessSettings,
5044
4570
  ModuleWebsiteSettings,
4571
+ SettingForm,
5045
4572
  SettingTabs,
5046
4573
  UserDetail,
5047
- WUJIES_COMPONENT_NAMES
4574
+ WUJIES_COMPONENT_NAMES,
4575
+ WUJIES_HOST_ONLY_COMPONENT_NAMES
5048
4576
  };
5049
4577
  //# sourceMappingURL=index.js.map