jky-component-lib 0.0.49 → 0.0.53

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 (42) hide show
  1. package/dist/es/code-mirror-editor/CodeMirrorEditor.test.d.ts +1 -0
  2. package/dist/es/code-mirror-editor/CodeMirrorEditor.vue.d.ts +25 -0
  3. package/dist/es/code-mirror-editor/CodeMirrorEditor.vue.js +178 -0
  4. package/dist/es/code-mirror-editor/CodeMirrorEditor.vue3.js +5 -0
  5. package/dist/es/code-mirror-editor/index.d.ts +4 -0
  6. package/dist/es/code-mirror-editor/index.js +8 -0
  7. package/dist/es/code-mirror-editor/style.css +44 -0
  8. package/dist/es/components.d.ts +1 -0
  9. package/dist/es/components.js +4 -1
  10. package/dist/es/form/FormItem.vue.js +245 -94
  11. package/dist/es/index.js +2 -0
  12. package/dist/es/node_modules/@element-plus/icons-vue/dist/index.js +84 -0
  13. package/dist/es/package.json.js +2 -2
  14. package/dist/es/page-header/PopoverMenu.vue.d.ts +1 -1
  15. package/dist/es/style.css +125 -4
  16. package/dist/es/styles.css +1 -1
  17. package/dist/lib/button/Button.vue.js +10 -10
  18. package/dist/lib/button-nav/ButtonNav.vue.js +4 -4
  19. package/dist/lib/code-mirror-editor/CodeMirrorEditor.test.d.ts +1 -0
  20. package/dist/lib/code-mirror-editor/CodeMirrorEditor.vue.d.ts +25 -0
  21. package/dist/lib/code-mirror-editor/CodeMirrorEditor.vue.js +178 -0
  22. package/dist/lib/code-mirror-editor/CodeMirrorEditor.vue3.js +5 -0
  23. package/dist/lib/code-mirror-editor/index.d.ts +4 -0
  24. package/dist/lib/code-mirror-editor/index.js +8 -0
  25. package/dist/lib/code-mirror-editor/style.css +44 -0
  26. package/dist/lib/components.d.ts +1 -0
  27. package/dist/lib/components.js +15 -12
  28. package/dist/lib/form/Form.vue.js +6 -6
  29. package/dist/lib/form/FormItem.vue.js +248 -97
  30. package/dist/lib/index.js +10 -8
  31. package/dist/lib/menu/Aside.vue.js +2 -2
  32. package/dist/lib/menu/Menu.vue.js +2 -2
  33. package/dist/lib/node_modules/@element-plus/icons-vue/dist/index.js +84 -0
  34. package/dist/lib/package.json.js +2 -2
  35. package/dist/lib/page-header/PageHeader.vue.js +2 -2
  36. package/dist/lib/page-header/PopoverMenu.vue.d.ts +1 -1
  37. package/dist/lib/page-header/PopoverMenu.vue.js +12 -12
  38. package/dist/lib/style.css +125 -4
  39. package/dist/lib/styles.css +1 -1
  40. package/dist/umd/index.js +626 -104
  41. package/dist/umd/styles.css +1 -1
  42. package/package.json +6 -1
package/dist/umd/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("element-plus")) : typeof define === "function" && define.amd ? define(["exports", "vue", "element-plus"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.JkyComponentLib = {}, global.Vue, global.ElementPlus));
3
- })(this, (function(exports2, vue, ElementPlus) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("element-plus"), require("@codemirror/lang-css"), require("@codemirror/lang-javascript"), require("@codemirror/lang-json"), require("@codemirror/state"), require("@codemirror/theme-one-dark"), require("@codemirror/view"), require("codemirror")) : typeof define === "function" && define.amd ? define(["exports", "vue", "element-plus", "@codemirror/lang-css", "@codemirror/lang-javascript", "@codemirror/lang-json", "@codemirror/state", "@codemirror/theme-one-dark", "@codemirror/view", "codemirror"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.JkyComponentLib = {}, global.Vue, global.ElementPlus, global.langCss, global.langJavascript, global.langJson, global.state, global.themeOneDark, global.view, global.codemirror));
3
+ })(this, (function(exports2, vue, ElementPlus, langCss, langJavascript, langJson, state, themeOneDark, view, codemirror) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defProps = Object.defineProperties;
6
6
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -275,6 +275,50 @@ to {
275
275
  .jky-button-nav-dropdown {
276
276
  /* 不覆盖任何样式,保持 el-dropdown-menu 默认样式 */
277
277
  }
278
+ :root {
279
+ /* CodeMirror 编辑器基础样式变量 */
280
+ --j-code-mirror-border-color: #dcdfe6;
281
+ --j-code-mirror-border-radius: 4px;
282
+ --j-code-mirror-height: 400px;
283
+ }
284
+ .j-code-mirror-editor {
285
+ width: 100%;
286
+ height: var(--j-code-mirror-height);
287
+ border: 1px solid var(--j-code-mirror-border-color);
288
+ border-radius: var(--j-code-mirror-border-radius);
289
+ overflow: hidden;
290
+ }
291
+ .code-mirror-container {
292
+ height: 100%;
293
+ width: 100%;
294
+ overflow: auto;
295
+ }
296
+
297
+ /* CodeMirror 基础样式覆盖 */
298
+ .code-mirror-container .cm-editor {
299
+ height: 100%;
300
+ }
301
+ .code-mirror-container .cm-scroller {
302
+ overflow: auto;
303
+ font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
304
+ font-size: 14px;
305
+ line-height: 1.5;
306
+ }
307
+ .code-mirror-container .cm-gutters {
308
+ background-color: #f5f7fa;
309
+ border-right: 1px solid #e4e7ed;
310
+ color: #909399;
311
+ }
312
+
313
+ /* 暗黑模式支持 */
314
+ html.dark .j-code-mirror-editor {
315
+ border-color: #4c4d4f;
316
+ }
317
+ html.dark .code-mirror-container .cm-gutters {
318
+ background-color: #2c2d2d;
319
+ border-color: #4c4d4f;
320
+ color: #909399;
321
+ }
278
322
  :root {
279
323
  /* 表单组件间距 */
280
324
  /* --jky-form-item-gap: 12px; */
@@ -664,6 +708,8 @@ img {
664
708
  --color-gray-600: oklch(44.6% .03 256.802);
665
709
  --color-white: #fff;
666
710
  --spacing: .25rem;
711
+ --text-xs: .75rem;
712
+ --text-xs--line-height: calc(1 / .75);
667
713
  --text-sm: .875rem;
668
714
  --text-sm--line-height: calc(1.25 / .875);
669
715
  --text-base: 1rem;
@@ -952,6 +998,10 @@ img {
952
998
  position: relative;
953
999
  }
954
1000
 
1001
+ .static {
1002
+ position: static;
1003
+ }
1004
+
955
1005
  .sticky {
956
1006
  position: sticky;
957
1007
  }
@@ -960,6 +1010,10 @@ img {
960
1010
  inset-inline-start: var(--spacing);
961
1011
  }
962
1012
 
1013
+ .end {
1014
+ inset-inline-end: var(--spacing);
1015
+ }
1016
+
963
1017
  .top-0 {
964
1018
  top: calc(var(--spacing) * 0);
965
1019
  }
@@ -1004,6 +1058,40 @@ img {
1004
1058
  grid-column: span 24 / span 24;
1005
1059
  }
1006
1060
 
1061
+ .container {
1062
+ width: 100%;
1063
+ }
1064
+
1065
+ @media (min-width: 40rem) {
1066
+ .container {
1067
+ max-width: 40rem;
1068
+ }
1069
+ }
1070
+
1071
+ @media (min-width: 48rem) {
1072
+ .container {
1073
+ max-width: 48rem;
1074
+ }
1075
+ }
1076
+
1077
+ @media (min-width: 64rem) {
1078
+ .container {
1079
+ max-width: 64rem;
1080
+ }
1081
+ }
1082
+
1083
+ @media (min-width: 80rem) {
1084
+ .container {
1085
+ max-width: 80rem;
1086
+ }
1087
+ }
1088
+
1089
+ @media (min-width: 96rem) {
1090
+ .container {
1091
+ max-width: 96rem;
1092
+ }
1093
+ }
1094
+
1007
1095
  .mt-1 {
1008
1096
  margin-top: calc(var(--spacing) * 1);
1009
1097
  }
@@ -1588,6 +1676,10 @@ img {
1588
1676
  width: calc(var(--spacing) * 20);
1589
1677
  }
1590
1678
 
1679
+ .w-100 {
1680
+ width: calc(var(--spacing) * 100);
1681
+ }
1682
+
1591
1683
  .w-fit {
1592
1684
  width: fit-content;
1593
1685
  }
@@ -1600,6 +1692,10 @@ img {
1600
1692
  width: 100%;
1601
1693
  }
1602
1694
 
1695
+ .w-full\\! {
1696
+ width: 100% !important;
1697
+ }
1698
+
1603
1699
  .flex-1 {
1604
1700
  flex: 1;
1605
1701
  }
@@ -1673,6 +1769,10 @@ img {
1673
1769
  align-self: center;
1674
1770
  }
1675
1771
 
1772
+ .rounded {
1773
+ border-radius: .25rem;
1774
+ }
1775
+
1676
1776
  .rounded-full {
1677
1777
  border-radius: 3.40282e38px;
1678
1778
  }
@@ -1708,6 +1808,26 @@ img {
1708
1808
  border-left-color: var(--el-color-primary);
1709
1809
  }
1710
1810
 
1811
+ .bg-\\(--el-color-error\\)\\/10 {
1812
+ background-color: var(--el-color-error);
1813
+ }
1814
+
1815
+ @supports (color: color-mix(in lab, red, red)) {
1816
+ .bg-\\(--el-color-error\\)\\/10 {
1817
+ background-color: color-mix(in oklab, var(--el-color-error) 10%, transparent);
1818
+ }
1819
+ }
1820
+
1821
+ .bg-\\(--el-color-info\\)\\/10 {
1822
+ background-color: var(--el-color-info);
1823
+ }
1824
+
1825
+ @supports (color: color-mix(in lab, red, red)) {
1826
+ .bg-\\(--el-color-info\\)\\/10 {
1827
+ background-color: color-mix(in oklab, var(--el-color-info) 10%, transparent);
1828
+ }
1829
+ }
1830
+
1711
1831
  .bg-\\(--el-color-primary\\)\\/50 {
1712
1832
  background-color: var(--el-color-primary);
1713
1833
  }
@@ -1718,6 +1838,26 @@ img {
1718
1838
  }
1719
1839
  }
1720
1840
 
1841
+ .bg-\\(--el-color-success\\)\\/10 {
1842
+ background-color: var(--el-color-success);
1843
+ }
1844
+
1845
+ @supports (color: color-mix(in lab, red, red)) {
1846
+ .bg-\\(--el-color-success\\)\\/10 {
1847
+ background-color: color-mix(in oklab, var(--el-color-success) 10%, transparent);
1848
+ }
1849
+ }
1850
+
1851
+ .bg-\\(--el-color-warning\\)\\/10 {
1852
+ background-color: var(--el-color-warning);
1853
+ }
1854
+
1855
+ @supports (color: color-mix(in lab, red, red)) {
1856
+ .bg-\\(--el-color-warning\\)\\/10 {
1857
+ background-color: color-mix(in oklab, var(--el-color-warning) 10%, transparent);
1858
+ }
1859
+ }
1860
+
1721
1861
  .bg-\\(--my-var\\), .bg-\\[var\\(--my-var\\)\\] {
1722
1862
  background-color: var(--my-var);
1723
1863
  }
@@ -1774,10 +1914,18 @@ img {
1774
1914
  padding: calc(var(--spacing) * 4);
1775
1915
  }
1776
1916
 
1917
+ .px-2 {
1918
+ padding-inline: calc(var(--spacing) * 2);
1919
+ }
1920
+
1777
1921
  .px-4 {
1778
1922
  padding-inline: calc(var(--spacing) * 4);
1779
1923
  }
1780
1924
 
1925
+ .py-1\\.5 {
1926
+ padding-block: calc(var(--spacing) * 1.5);
1927
+ }
1928
+
1781
1929
  .py-2 {
1782
1930
  padding-block: calc(var(--spacing) * 2);
1783
1931
  }
@@ -1790,10 +1938,6 @@ img {
1790
1938
  padding-bottom: calc(var(--spacing) * 0);
1791
1939
  }
1792
1940
 
1793
- .pl-1 {
1794
- padding-left: calc(var(--spacing) * 1);
1795
- }
1796
-
1797
1941
  .pl-1\\.5 {
1798
1942
  padding-left: calc(var(--spacing) * 1.5);
1799
1943
  }
@@ -1827,6 +1971,11 @@ img {
1827
1971
  line-height: var(--tw-leading, var(--text-xl--line-height));
1828
1972
  }
1829
1973
 
1974
+ .text-xs {
1975
+ font-size: var(--text-xs);
1976
+ line-height: var(--tw-leading, var(--text-xs--line-height));
1977
+ }
1978
+
1830
1979
  .font-bold {
1831
1980
  --tw-font-weight: var(--font-weight-bold);
1832
1981
  font-weight: var(--font-weight-bold);
@@ -1842,6 +1991,22 @@ img {
1842
1991
  font-weight: var(--font-weight-semibold);
1843
1992
  }
1844
1993
 
1994
+ .text-\\(--el-color-error\\) {
1995
+ color: var(--el-color-error);
1996
+ }
1997
+
1998
+ .text-\\(--el-color-info\\) {
1999
+ color: var(--el-color-info);
2000
+ }
2001
+
2002
+ .text-\\(--el-color-success\\) {
2003
+ color: var(--el-color-success);
2004
+ }
2005
+
2006
+ .text-\\(--el-color-warning\\) {
2007
+ color: var(--el-color-warning);
2008
+ }
2009
+
1845
2010
  .text-\\[white\\] {
1846
2011
  color: #fff;
1847
2012
  }
@@ -2210,7 +2375,7 @@ img {
2210
2375
  }
2211
2376
  /*$vite$:1*/`;
2212
2377
  document.head.appendChild(__vite_style__);
2213
- const version$1 = "0.0.49";
2378
+ const version$1 = "0.0.53";
2214
2379
  const INSTALLED_KEY = Symbol("INSTALLED_KEY");
2215
2380
  function createInstaller(components2 = []) {
2216
2381
  const install2 = (app, options) => {
@@ -2249,7 +2414,7 @@ img {
2249
2414
  key: 1,
2250
2415
  class: "jky-button__icon"
2251
2416
  };
2252
- const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
2417
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
2253
2418
  name: "JkyButton"
2254
2419
  }), {
2255
2420
  __name: "Button",
@@ -2331,9 +2496,9 @@ img {
2331
2496
  };
2332
2497
  }
2333
2498
  }));
2334
- const JkyButton = installWithSFC(_sfc_main$8);
2499
+ const JkyButton = installWithSFC(_sfc_main$9);
2335
2500
  const _hoisted_1$4 = { class: "jky-button-nav flex flex-wrap items-center gap-2" };
2336
- const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
2501
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
2337
2502
  name: "JkyButtonNav"
2338
2503
  }), {
2339
2504
  __name: "ButtonNav",
@@ -2454,21 +2619,247 @@ img {
2454
2619
  };
2455
2620
  }
2456
2621
  }));
2457
- const JkyButtonNav = installWithSFC(_sfc_main$7);
2622
+ const JkyButtonNav = installWithSFC(_sfc_main$8);
2623
+ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
2624
+ name: "JkyCodeMirrorEditor"
2625
+ }), {
2626
+ __name: "CodeMirrorEditor",
2627
+ props: {
2628
+ modelValue: { default: "" },
2629
+ height: { default: "400px" },
2630
+ disabled: { type: Boolean, default: false },
2631
+ readonly: { type: Boolean, default: false },
2632
+ language: { default: "javascript" },
2633
+ theme: { default: "oneDark" },
2634
+ lineNumbers: { type: Boolean, default: true },
2635
+ lineWrapping: { type: Boolean, default: false }
2636
+ },
2637
+ emits: ["update:modelValue", "change"],
2638
+ setup(__props, { expose: __expose, emit: __emit }) {
2639
+ var _a;
2640
+ const props = __props;
2641
+ const emit = __emit;
2642
+ const editorRef = vue.ref();
2643
+ let editorView = null;
2644
+ let innerValue = (_a = props.modelValue) != null ? _a : "";
2645
+ function getLanguageExtension(language) {
2646
+ switch (language) {
2647
+ case "typescript":
2648
+ case "javascript":
2649
+ return langJavascript.javascript({
2650
+ jsx: true,
2651
+ typescript: language === "typescript"
2652
+ });
2653
+ case "json":
2654
+ return langJson.json();
2655
+ case "css":
2656
+ return langCss.css();
2657
+ default:
2658
+ return langJavascript.javascript();
2659
+ }
2660
+ }
2661
+ function initializeEditor() {
2662
+ if (!editorRef.value)
2663
+ return;
2664
+ const extensions = [
2665
+ codemirror.basicSetup,
2666
+ getLanguageExtension(props.language),
2667
+ view.EditorView.updateListener.of((update) => {
2668
+ if (update.docChanged) {
2669
+ const newValue = update.state.doc.toString();
2670
+ innerValue = newValue;
2671
+ emit("change", newValue);
2672
+ emit("update:modelValue", newValue);
2673
+ }
2674
+ }),
2675
+ view.EditorView.editable.of(!props.disabled && !props.readonly),
2676
+ state.EditorState.readOnly.of(props.readonly)
2677
+ ];
2678
+ if (props.theme === "oneDark") {
2679
+ extensions.push(themeOneDark.oneDark);
2680
+ }
2681
+ if (!props.lineNumbers) {
2682
+ extensions.push(view.lineNumbers());
2683
+ }
2684
+ if (props.lineWrapping) {
2685
+ extensions.push(view.EditorView.lineWrapping);
2686
+ }
2687
+ try {
2688
+ editorView = new view.EditorView({
2689
+ state: state.EditorState.create({
2690
+ doc: innerValue,
2691
+ extensions
2692
+ }),
2693
+ parent: editorRef.value
2694
+ });
2695
+ } catch (error) {
2696
+ console.error("Failed to initialize CodeMirror Editor:", error);
2697
+ }
2698
+ }
2699
+ vue.watch(() => props.modelValue, (newValue) => {
2700
+ if (newValue !== innerValue && editorView) {
2701
+ const currentContent = editorView.state.doc.toString();
2702
+ if (currentContent !== newValue) {
2703
+ editorView.dispatch({
2704
+ changes: {
2705
+ from: 0,
2706
+ to: currentContent.length,
2707
+ insert: newValue
2708
+ }
2709
+ });
2710
+ innerValue = newValue;
2711
+ }
2712
+ }
2713
+ });
2714
+ vue.watch(() => props.language, () => {
2715
+ if (editorView) {
2716
+ const currentValue = editorView.state.doc.toString();
2717
+ editorView.destroy();
2718
+ innerValue = currentValue;
2719
+ initializeEditor();
2720
+ }
2721
+ });
2722
+ vue.watch([() => props.disabled, () => props.readonly], () => {
2723
+ if (editorView) {
2724
+ const currentValue = editorView.state.doc.toString();
2725
+ editorView.destroy();
2726
+ innerValue = currentValue;
2727
+ initializeEditor();
2728
+ }
2729
+ });
2730
+ vue.onMounted(() => {
2731
+ initializeEditor();
2732
+ });
2733
+ vue.onUnmounted(() => {
2734
+ if (editorView) {
2735
+ editorView.destroy();
2736
+ editorView = null;
2737
+ }
2738
+ });
2739
+ __expose({
2740
+ getEditor: () => editorView,
2741
+ getContent: () => {
2742
+ var _a2;
2743
+ return (_a2 = editorView == null ? void 0 : editorView.state.doc.toString()) != null ? _a2 : "";
2744
+ },
2745
+ setContent: (content) => {
2746
+ if (editorView) {
2747
+ editorView.dispatch({
2748
+ changes: {
2749
+ from: 0,
2750
+ to: editorView.state.doc.length,
2751
+ insert: content
2752
+ }
2753
+ });
2754
+ }
2755
+ }
2756
+ });
2757
+ return (_ctx, _cache) => {
2758
+ return vue.openBlock(), vue.createElementBlock("div", {
2759
+ class: "j-code-mirror-editor",
2760
+ style: vue.normalizeStyle({ height: __props.height })
2761
+ }, [
2762
+ vue.createElementVNode("div", {
2763
+ ref_key: "editorRef",
2764
+ ref: editorRef,
2765
+ class: "code-mirror-container"
2766
+ }, null, 512)
2767
+ ], 4);
2768
+ };
2769
+ }
2770
+ }));
2771
+ const JkyCodeMirrorEditor = installWithSFC(_sfc_main$7);
2772
+ /*! Element Plus Icons Vue v2.3.2 */
2773
+ var _sfc_main48 = /* @__PURE__ */ vue.defineComponent({
2774
+ name: "CircleCheckFilled",
2775
+ __name: "circle-check-filled",
2776
+ setup(__props) {
2777
+ return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
2778
+ xmlns: "http://www.w3.org/2000/svg",
2779
+ viewBox: "0 0 1024 1024"
2780
+ }, [
2781
+ vue.createElementVNode("path", {
2782
+ fill: "currentColor",
2783
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
2784
+ })
2785
+ ]));
2786
+ }
2787
+ }), circle_check_filled_default = _sfc_main48;
2788
+ var _sfc_main50 = /* @__PURE__ */ vue.defineComponent({
2789
+ name: "CircleCloseFilled",
2790
+ __name: "circle-close-filled",
2791
+ setup(__props) {
2792
+ return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
2793
+ xmlns: "http://www.w3.org/2000/svg",
2794
+ viewBox: "0 0 1024 1024"
2795
+ }, [
2796
+ vue.createElementVNode("path", {
2797
+ fill: "currentColor",
2798
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
2799
+ })
2800
+ ]));
2801
+ }
2802
+ }), circle_close_filled_default = _sfc_main50;
2803
+ var _sfc_main201 = /* @__PURE__ */ vue.defineComponent({
2804
+ name: "Plus",
2805
+ __name: "plus",
2806
+ setup(__props) {
2807
+ return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
2808
+ xmlns: "http://www.w3.org/2000/svg",
2809
+ viewBox: "0 0 1024 1024"
2810
+ }, [
2811
+ vue.createElementVNode("path", {
2812
+ fill: "currentColor",
2813
+ d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
2814
+ })
2815
+ ]));
2816
+ }
2817
+ }), plus_default = _sfc_main201;
2818
+ var _sfc_main211 = /* @__PURE__ */ vue.defineComponent({
2819
+ name: "QuestionFilled",
2820
+ __name: "question-filled",
2821
+ setup(__props) {
2822
+ return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
2823
+ xmlns: "http://www.w3.org/2000/svg",
2824
+ viewBox: "0 0 1024 1024"
2825
+ }, [
2826
+ vue.createElementVNode("path", {
2827
+ fill: "currentColor",
2828
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"
2829
+ })
2830
+ ]));
2831
+ }
2832
+ }), question_filled_default = _sfc_main211;
2833
+ var _sfc_main287 = /* @__PURE__ */ vue.defineComponent({
2834
+ name: "WarningFilled",
2835
+ __name: "warning-filled",
2836
+ setup(__props) {
2837
+ return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
2838
+ xmlns: "http://www.w3.org/2000/svg",
2839
+ viewBox: "0 0 1024 1024"
2840
+ }, [
2841
+ vue.createElementVNode("path", {
2842
+ fill: "currentColor",
2843
+ d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
2844
+ })
2845
+ ]));
2846
+ }
2847
+ }), warning_filled_default = _sfc_main287;
2458
2848
  const _hoisted_1$3 = {
2459
2849
  key: 0,
2460
2850
  style: { "display": "none" }
2461
2851
  };
2462
- const _hoisted_2$3 = { class: "jky-form-item__title text-base font-medium" };
2463
- const _hoisted_3$2 = {
2852
+ const _hoisted_2$3 = { class: "jky-form-item__title text-base font-medium flex items-center" };
2853
+ const _hoisted_3$2 = { class: "flex items-center" };
2854
+ const _hoisted_4$2 = {
2464
2855
  key: 0,
2465
2856
  class: "flex items-center"
2466
2857
  };
2467
- const _hoisted_4$2 = {
2858
+ const _hoisted_5$2 = {
2468
2859
  key: 0,
2469
2860
  class: "mr-2"
2470
2861
  };
2471
- const _hoisted_5$2 = {
2862
+ const _hoisted_6$1 = {
2472
2863
  key: 1,
2473
2864
  class: "ml-2"
2474
2865
  };
@@ -2498,20 +2889,43 @@ img {
2498
2889
  },
2499
2890
  setup(__props) {
2500
2891
  const props = __props;
2501
- const componentProps = vue.computed(() => {
2502
- const configProps = props.config.componentProps;
2503
- if (!configProps) {
2504
- return {};
2505
- }
2506
- if (typeof configProps === "function") {
2507
- return configProps({
2508
- model: props.model,
2509
- field: props.field,
2510
- $form: props.model
2511
- });
2512
- }
2513
- return configProps;
2514
- });
2892
+ const loading = vue.ref(false);
2893
+ const componentProps = vue.ref({});
2894
+ function loadComponentProps() {
2895
+ return __async(this, null, function* () {
2896
+ const configProps = props.config.componentProps;
2897
+ if (!configProps) {
2898
+ componentProps.value = {};
2899
+ return;
2900
+ }
2901
+ if (typeof configProps === "function") {
2902
+ loading.value = true;
2903
+ try {
2904
+ const result = yield configProps({
2905
+ model: props.model,
2906
+ field: props.field,
2907
+ $form: props.model
2908
+ });
2909
+ componentProps.value = result || {};
2910
+ } catch (error) {
2911
+ console.error("Failed to load component props:", error);
2912
+ componentProps.value = {};
2913
+ } finally {
2914
+ loading.value = false;
2915
+ }
2916
+ return;
2917
+ }
2918
+ componentProps.value = configProps;
2919
+ });
2920
+ }
2921
+ vue.watch(
2922
+ () => props.model,
2923
+ () => {
2924
+ loadComponentProps();
2925
+ },
2926
+ { deep: true }
2927
+ );
2928
+ loadComponentProps();
2515
2929
  const modelValue = vue.computed({
2516
2930
  get: () => props.model[props.field],
2517
2931
  set: (val) => {
@@ -2580,7 +2994,13 @@ img {
2580
2994
  return rest;
2581
2995
  });
2582
2996
  function renderComponent(type) {
2583
- var _a, _b, _c;
2997
+ var _a, _b;
2998
+ if (type === "divider") {
2999
+ const dividerProps = __spreadValues({}, componentProps.value);
3000
+ return vue.h(ElementPlus.ElDivider, dividerProps, {
3001
+ default: () => props.config.children || null
3002
+ });
3003
+ }
2584
3004
  const commonProps = __spreadValues({
2585
3005
  "modelValue": modelValue.value,
2586
3006
  "onUpdate:modelValue": (val) => {
@@ -2588,11 +3008,8 @@ img {
2588
3008
  },
2589
3009
  "placeholder": props.config.placeholder,
2590
3010
  "disabled": props.disabled,
2591
- "clearable": (_a = props.config.clearable) != null ? _a : true
3011
+ "clearable": props.config.clearable
2592
3012
  }, componentProps.value);
2593
- const inputNumberProps = type === "input-number" ? __spreadProps(__spreadValues({}, commonProps), {
2594
- modelValue: commonProps.modelValue === "" ? null : commonProps.modelValue
2595
- }) : commonProps;
2596
3013
  switch (type) {
2597
3014
  case "input":
2598
3015
  return vue.h(ElementPlus.ElInput, __spreadProps(__spreadValues({}, commonProps), {
@@ -2605,96 +3022,185 @@ img {
2605
3022
  rows: 4
2606
3023
  }));
2607
3024
  case "select": {
2608
- const options = props.config.options || [];
2609
- return vue.h(
2610
- ElementPlus.ElSelect,
2611
- __spreadProps(__spreadValues({}, commonProps), {
2612
- multiple: props.config.multiple,
2613
- filterable: props.config.filterable
2614
- }),
2615
- {
2616
- default: () => options.map(
2617
- (option) => vue.h(ElementPlus.ElOption, {
2618
- key: option.value,
2619
- label: option.label,
2620
- value: option.value,
2621
- disabled: option.disabled
2622
- })
2623
- )
2624
- }
2625
- );
3025
+ const selectProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
3026
+ return vue.h(ElementPlus.ElSelect, selectProps);
3027
+ }
3028
+ case "autocomplete": {
3029
+ const autocompleteProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
3030
+ return vue.h(ElementPlus.ElAutocomplete, autocompleteProps);
2626
3031
  }
2627
3032
  case "datepicker":
2628
- return vue.h(ElementPlus.ElDatePicker, __spreadProps(__spreadValues({}, commonProps), {
2629
- type: "date"
2630
- }));
3033
+ return vue.h(ElementPlus.ElDatePicker, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
2631
3034
  case "datetime-picker":
2632
- return vue.h(ElementPlus.ElDatePicker, __spreadProps(__spreadValues({}, commonProps), {
2633
- type: "datetime"
2634
- }));
3035
+ return vue.h(ElementPlus.ElDatePicker, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
2635
3036
  case "time-picker":
2636
- return vue.h(ElementPlus.ElTimePicker, __spreadValues({}, commonProps));
3037
+ return vue.h(ElementPlus.ElTimePicker, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
2637
3038
  case "time-select":
2638
- return vue.h(ElementPlus.ElTimeSelect, __spreadValues({}, commonProps));
3039
+ return vue.h(ElementPlus.ElTimeSelect, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
2639
3040
  case "radio-group": {
2640
- const options = props.config.options || [];
3041
+ const radioGroupProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
2641
3042
  return vue.h(
2642
3043
  ElementPlus.ElRadioGroup,
2643
- __spreadValues({}, commonProps),
3044
+ radioGroupProps,
2644
3045
  {
2645
- default: () => options.map(
2646
- (option) => vue.h(ElementPlus.ElRadio, {
2647
- key: option.value,
2648
- value: option.value,
2649
- disabled: option.disabled
2650
- }, {
2651
- default: () => option.label
2652
- })
2653
- )
3046
+ default: () => {
3047
+ const options = componentProps.value.options || props.config.options || [];
3048
+ return options.map(
3049
+ (option) => vue.h(ElementPlus.ElRadio, {
3050
+ key: option.value,
3051
+ value: option.value,
3052
+ disabled: option.disabled
3053
+ }, {
3054
+ default: () => option.label
3055
+ })
3056
+ );
3057
+ }
2654
3058
  }
2655
3059
  );
2656
3060
  }
2657
3061
  case "checkbox-group": {
2658
- const options = props.config.options || [];
2659
3062
  const arrayModelValue = Array.isArray(modelValue.value) ? modelValue.value : [];
3063
+ const checkboxGroupProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
3064
+ modelValue: arrayModelValue
3065
+ }), componentProps.value);
2660
3066
  return vue.h(
2661
3067
  ElementPlus.ElCheckboxGroup,
2662
- __spreadProps(__spreadValues({}, commonProps), {
2663
- modelValue: arrayModelValue
2664
- }),
3068
+ checkboxGroupProps,
2665
3069
  {
2666
- default: () => options.map(
2667
- (option) => vue.h(ElementPlus.ElCheckbox, {
2668
- key: option.value,
2669
- value: option.value,
2670
- disabled: option.disabled
2671
- }, {
2672
- default: () => option.label
2673
- })
2674
- )
3070
+ default: () => {
3071
+ const options = componentProps.value.options || props.config.options || [];
3072
+ return options.map(
3073
+ (option) => vue.h(ElementPlus.ElCheckbox, {
3074
+ key: option.value,
3075
+ value: option.value,
3076
+ disabled: option.disabled
3077
+ }, {
3078
+ default: () => option.label
3079
+ })
3080
+ );
3081
+ }
2675
3082
  }
2676
3083
  );
2677
3084
  }
2678
3085
  case "switch":
2679
- return vue.h(ElementPlus.ElSwitch, __spreadValues({}, commonProps));
3086
+ return vue.h(ElementPlus.ElSwitch, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
2680
3087
  case "slider":
2681
- return vue.h(ElementPlus.ElSlider, __spreadValues({}, commonProps));
2682
- case "cascader":
2683
- return vue.h(ElementPlus.ElCascader, __spreadProps(__spreadValues({}, commonProps), {
2684
- options: props.config.options
2685
- }));
3088
+ return vue.h(ElementPlus.ElSlider, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
3089
+ case "cascader": {
3090
+ const cascaderProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
3091
+ return vue.h(ElementPlus.ElCascader, cascaderProps);
3092
+ }
3093
+ case "tree-select": {
3094
+ const treeSelectProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
3095
+ return vue.h(ElementPlus.ElTreeSelect, treeSelectProps);
3096
+ }
2686
3097
  case "color-picker":
2687
- return vue.h(ElementPlus.ElColorPicker, __spreadValues({}, commonProps));
3098
+ return vue.h(ElementPlus.ElColorPicker, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
2688
3099
  case "rate":
2689
- return vue.h(ElementPlus.ElRate, __spreadValues({}, commonProps));
2690
- case "input-number":
3100
+ return vue.h(ElementPlus.ElRate, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
3101
+ case "input-number": {
3102
+ const numberModelValue = modelValue.value === "" || modelValue.value === null || modelValue.value === void 0 ? null : Number(modelValue.value);
3103
+ const inputNumberProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
3104
+ "modelValue": numberModelValue,
3105
+ "onUpdate:modelValue": (val) => {
3106
+ props.model[props.field] = val;
3107
+ }
3108
+ }), componentProps.value);
2691
3109
  return vue.h(ElementPlus.ElInputNumber, inputNumberProps);
3110
+ }
3111
+ // 图片上传
3112
+ case "image-upload": {
3113
+ const uploadProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
3114
+ "action": componentProps.value.action || "#",
3115
+ "file-list": componentProps.value.fileList || [],
3116
+ "list-type": componentProps.value.listType || "picture-card",
3117
+ "onPreview": componentProps.value.onPreview,
3118
+ "onRemove": componentProps.value.onRemove
3119
+ }), componentProps.value);
3120
+ if (uploadProps["list-type"] === "picture-card") {
3121
+ return vue.h(ElementPlus.ElUpload, uploadProps, {
3122
+ default: () => vue.h("div", { class: "el-upload__picture-card-wrapper" }, [
3123
+ vue.h(ElementPlus.ElIcon, { size: 24 }, { default: () => vue.h(plus_default) })
3124
+ ])
3125
+ });
3126
+ }
3127
+ if (uploadProps["list-type"] === "picture") {
3128
+ return vue.h(ElementPlus.ElUpload, uploadProps, {
3129
+ default: () => vue.h(ElementPlus.ElButton, { type: "primary" }, { default: () => "点击上传" })
3130
+ });
3131
+ }
3132
+ return vue.h(ElementPlus.ElUpload, uploadProps);
3133
+ }
3134
+ // 文件上传
3135
+ case "file-upload": {
3136
+ const uploadProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
3137
+ "action": componentProps.value.action || "#",
3138
+ "file-list": componentProps.value.fileList || [],
3139
+ "list-type": componentProps.value.listType || "text",
3140
+ "onPreview": componentProps.value.onPreview,
3141
+ "onRemove": componentProps.value.onRemove
3142
+ }), componentProps.value);
3143
+ if (uploadProps["list-type"] === "text") {
3144
+ return vue.h(ElementPlus.ElUpload, uploadProps, {
3145
+ default: () => vue.h(ElementPlus.ElButton, { type: "primary" }, { default: () => "点击上传" })
3146
+ });
3147
+ }
3148
+ return vue.h(ElementPlus.ElUpload, uploadProps);
3149
+ }
2692
3150
  case "custom":
2693
- return (_c = (_b = props.config).render) == null ? void 0 : _c.call(_b, commonProps);
3151
+ return (_b = (_a = props.config).render) == null ? void 0 : _b.call(_a, commonProps);
2694
3152
  default:
2695
3153
  return vue.h(ElementPlus.ElInput, commonProps);
2696
3154
  }
2697
3155
  }
3156
+ function renderHelpTooltip() {
3157
+ if (!props.config.help)
3158
+ return null;
3159
+ const { help } = props.config;
3160
+ const { text, type = "info", position = "top" } = help;
3161
+ const iconMap = {
3162
+ info: { icon: question_filled_default, color: "var(--el-color-info)" },
3163
+ warning: { icon: warning_filled_default, color: "var(--el-color-warning)" },
3164
+ success: { icon: circle_check_filled_default, color: "var(--el-color-success)" },
3165
+ error: { icon: circle_close_filled_default, color: "var(--el-color-error)" }
3166
+ };
3167
+ const { icon, color } = iconMap[type];
3168
+ return vue.h(
3169
+ ElementPlus.ElTooltip,
3170
+ {
3171
+ content: text,
3172
+ placement: position
3173
+ },
3174
+ {
3175
+ default: () => vue.h(
3176
+ ElementPlus.ElIcon,
3177
+ {
3178
+ style: { color, cursor: "pointer", marginLeft: "4px" },
3179
+ size: 16
3180
+ },
3181
+ { default: () => vue.h(icon) }
3182
+ )
3183
+ }
3184
+ );
3185
+ }
3186
+ function renderHelpText() {
3187
+ if (!props.config.help || props.config.help.tooltip)
3188
+ return null;
3189
+ const { text, type = "info" } = props.config.help;
3190
+ const typeStyles = {
3191
+ info: "bg-(--el-color-info)/10 text-(--el-color-info)",
3192
+ warning: "bg-(--el-color-warning)/10 text-(--el-color-warning)",
3193
+ success: "bg-(--el-color-success)/10 text-(--el-color-success)",
3194
+ error: "bg-(--el-color-error)/10 text-(--el-color-error)"
3195
+ };
3196
+ return vue.h(
3197
+ "div",
3198
+ {
3199
+ class: `jky-form-item__help mt-2 text-xs px-2 py-1.5 rounded ${typeStyles[type]}`
3200
+ },
3201
+ { default: () => text }
3202
+ );
3203
+ }
2698
3204
  return (_ctx, _cache) => {
2699
3205
  return isHidden.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3)) : __props.config.title && !__props.config.label ? (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElFormItem), vue.mergeProps({
2700
3206
  key: 1,
@@ -2707,9 +3213,11 @@ img {
2707
3213
  vue.createElementVNode("div", _hoisted_2$3, [
2708
3214
  __props.config.titleRender ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(__props.config.titleRender({ model: modelValue.value, field: __props.field })), { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
2709
3215
  vue.createTextVNode(vue.toDisplayString(__props.config.title), 1)
2710
- ], 64))
3216
+ ], 64)),
3217
+ __props.config.help && __props.config.help.tooltip ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderHelpTooltip()), { key: 2 })) : vue.createCommentVNode("", true)
2711
3218
  ]),
2712
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderComponent(__props.config.type || "input"))))
3219
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderComponent(__props.config.type || "input")))),
3220
+ __props.config.help && !__props.config.help.tooltip ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderHelpText()), { key: 0 })) : vue.createCommentVNode("", true)
2713
3221
  ]),
2714
3222
  _: 1
2715
3223
  }, 16, ["prop", "class", "style"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElFormItem), vue.mergeProps({
@@ -2718,16 +3226,28 @@ img {
2718
3226
  prop: __props.field
2719
3227
  }, __spreadValues(__spreadValues({}, formItemProps.value), _ctx.$attrs), {
2720
3228
  class: ["jky-form-item", [__props.config.className]]
2721
- }), {
3229
+ }), vue.createSlots({
2722
3230
  default: vue.withCtx(() => [
2723
- __props.config.prepend || __props.config.append ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, [
2724
- __props.config.prepend ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$2, vue.toDisplayString(__props.config.prepend), 1)) : vue.createCommentVNode("", true),
3231
+ __props.config.prepend || __props.config.append ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, [
3232
+ __props.config.prepend ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$2, vue.toDisplayString(__props.config.prepend), 1)) : vue.createCommentVNode("", true),
2725
3233
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderComponent(__props.config.type || "input")))),
2726
- __props.config.append ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$2, vue.toDisplayString(__props.config.append), 1)) : vue.createCommentVNode("", true)
2727
- ])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderComponent(__props.config.type || "input")), { key: 1 }))
3234
+ __props.config.append ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$1, vue.toDisplayString(__props.config.append), 1)) : vue.createCommentVNode("", true)
3235
+ ])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderComponent(__props.config.type || "input")), { key: 1 })),
3236
+ __props.config.help && !__props.config.help.tooltip ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderHelpText()), { key: 2 })) : vue.createCommentVNode("", true)
2728
3237
  ]),
2729
- _: 1
2730
- }, 16, ["label", "prop", "class"]));
3238
+ _: 2
3239
+ }, [
3240
+ __props.config.help && __props.config.help.tooltip ? {
3241
+ name: "label",
3242
+ fn: vue.withCtx(() => [
3243
+ vue.createElementVNode("div", _hoisted_3$2, [
3244
+ vue.createElementVNode("span", null, vue.toDisplayString(__props.config.label), 1),
3245
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderHelpTooltip())))
3246
+ ])
3247
+ ]),
3248
+ key: "0"
3249
+ } : void 0
3250
+ ]), 1040, ["label", "prop", "class"]));
2731
3251
  };
2732
3252
  }
2733
3253
  }));
@@ -3397,7 +3917,8 @@ img {
3397
3917
  JkyButtonNav,
3398
3918
  JkyPageHeader,
3399
3919
  JkyMenu,
3400
- JkyForm
3920
+ JkyForm,
3921
+ JkyCodeMirrorEditor
3401
3922
  ];
3402
3923
  function JkyComponentLibResolver() {
3403
3924
  return {
@@ -3420,6 +3941,7 @@ img {
3420
3941
  const version = installer.version;
3421
3942
  exports2.JkyButton = JkyButton;
3422
3943
  exports2.JkyButtonNav = JkyButtonNav;
3944
+ exports2.JkyCodeMirrorEditor = JkyCodeMirrorEditor;
3423
3945
  exports2.JkyComponentLibResolver = JkyComponentLibResolver;
3424
3946
  exports2.JkyForm = JkyForm;
3425
3947
  exports2.JkyMenu = JkyMenu;