jky-component-lib 0.0.125 → 0.0.126

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.
@@ -1,3 +1,14 @@
1
+ /* AMap 高德地图组件样式 */
2
+ .jky-amap-container {
3
+ /* 地图容器样式 */
4
+ position: relative;
5
+ overflow: hidden;
1
6
 
2
- /* 轨迹回放组件不需要额外样式 */
3
- /* 所有样式通过 TailwindCSS 工具类或外部组件控制 */
7
+ /* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
8
+ .amap-logo {
9
+ display: none !important;
10
+ }
11
+ .amap-copyright {
12
+ display: none !important;
13
+ }
14
+ }
@@ -1,14 +1,3 @@
1
- /* AMap 高德地图组件样式 */
2
- .jky-amap-container {
3
- /* 地图容器样式 */
4
- position: relative;
5
- overflow: hidden;
6
1
 
7
- /* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
8
- .amap-logo {
9
- display: none !important;
10
- }
11
- .amap-copyright {
12
- display: none !important;
13
- }
14
- }
2
+ /* 轨迹回放组件不需要额外样式 */
3
+ /* 所有样式通过 TailwindCSS 工具类或外部组件控制 */
@@ -4,7 +4,7 @@ import { JkyAMarker, JkyATrackPlayback } from "./amap/index.js";
4
4
  import { JkyButton } from "./button/index.js";
5
5
  import { JkyButtonNav } from "./button-nav/index.js";
6
6
  import { JkyCodeMirrorEditor } from "./code-mirror-editor/index.js";
7
- import { JkyForm } from "./form/index.js";
7
+ import { JkyForm, JkyLinkedSelect } from "./form/index.js";
8
8
  import { JkyMenu } from "./menu/index.js";
9
9
  import { JkyModal } from "./modal/index.js";
10
10
  import { JkyPageHeader } from "./page-header/index.js";
@@ -22,6 +22,7 @@ const components = [
22
22
  JkyPageHeader,
23
23
  JkyMenu,
24
24
  JkyForm,
25
+ JkyLinkedSelect,
25
26
  JkyCodeMirrorEditor,
26
27
  JkyAddInput,
27
28
  JkyRichEditor,
@@ -42,6 +43,7 @@ export {
42
43
  JkyButtonNav,
43
44
  JkyCodeMirrorEditor,
44
45
  JkyForm,
46
+ JkyLinkedSelect,
45
47
  JkyMenu,
46
48
  JkyModal,
47
49
  JkyPageHeader,
@@ -49,13 +49,15 @@ var __async = (__this, __arguments, generator) => {
49
49
  step((generator = generator.apply(__this, __arguments)).next());
50
50
  });
51
51
  };
52
- import { defineComponent, ref, watch, computed, openBlock, createElementBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, resolveDynamicComponent, Fragment, createTextVNode, toDisplayString, createCommentVNode, createSlots, h } from "vue";
52
+ import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, resolveDynamicComponent, Fragment, createTextVNode, toDisplayString, createCommentVNode, createSlots, h } from "vue";
53
53
  import { Plus, CircleCloseFilled, CircleCheckFilled, WarningFilled, QuestionFilled } from "@element-plus/icons-vue";
54
54
  import { ElFormItem, ElDivider, ElInput, ElUpload, ElButton, ElIcon, ElInputNumber, ElRate, ElTransfer, ElSelectV2, ElMention, ElInputTag, ElColorPickerPanel, ElColorPicker, ElTreeSelect, ElCascader, ElSlider, ElSwitch, ElCheckboxGroup, ElCheckbox, ElRadioGroup, ElRadioButton, ElRadio, ElTimeSelect, ElTimePicker, ElDatePicker, ElAutocomplete, ElSelect, ElTooltip } from "element-plus";
55
55
  import { JkyAddInput } from "../add-input/index.js";
56
56
  import { JkyCodeMirrorEditor } from "../code-mirror-editor/index.js";
57
57
  import { JkyRichEditor } from "../rich-editor/index.js";
58
- import _sfc_main$1 from "./SelectTable.vue.js";
58
+ import _sfc_main$1 from "./LinkedSelect.vue.js";
59
+ /* empty css */
60
+ import _sfc_main$2 from "./SelectTable.vue.js";
59
61
  /* empty css */
60
62
  const _hoisted_1 = {
61
63
  key: 0,
@@ -159,14 +161,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
159
161
  rules.value = configRules;
160
162
  });
161
163
  }
162
- watch(
163
- () => props.model,
164
- () => {
165
- loadComponentProps();
166
- loadRules();
167
- },
168
- { deep: true }
169
- );
170
164
  loadComponentProps();
171
165
  loadRules();
172
166
  const modelValue = computed({
@@ -175,6 +169,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
175
169
  props.model[props.field] = val;
176
170
  }
177
171
  });
172
+ watch(
173
+ () => props.model,
174
+ () => {
175
+ loadComponentProps();
176
+ loadRules();
177
+ },
178
+ { deep: true }
179
+ );
178
180
  const isHidden = computed(() => {
179
181
  if (typeof props.config.hidden === "function") {
180
182
  return props.config.hidden({
@@ -420,7 +422,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
420
422
  }
421
423
  // 表格选择器
422
424
  case "select-table":
423
- return h(_sfc_main$1, __spreadProps(__spreadValues(__spreadValues({}, commonProps), componentProps.value), {
425
+ return h(_sfc_main$2, __spreadProps(__spreadValues(__spreadValues({}, commonProps), componentProps.value), {
424
426
  labelWidth: formItemProps.value.labelWidth
425
427
  }), _componentSlotsObj);
426
428
  case "rate":
@@ -490,6 +492,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
490
492
  const addInputProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
491
493
  return h(JkyAddInput, addInputProps, _componentSlotsObj);
492
494
  }
495
+ // 联动下拉框
496
+ case "linked-select":
497
+ return h(_sfc_main$1, {
498
+ "config": props.config.config,
499
+ "modelValue": modelValue.value,
500
+ "disabled": props.disabled,
501
+ "componentProps": componentProps.value,
502
+ "onUpdate:modelValue": (val) => {
503
+ props.model[props.field] = val;
504
+ }
505
+ }, _componentSlotsObj);
493
506
  case "custom":
494
507
  return (_b = (_a = props.config).render) == null ? void 0 : _b.call(_a, commonProps);
495
508
  default:
@@ -0,0 +1,34 @@
1
+ import { LinkedSelectConfig } from './types';
2
+ interface Props {
3
+ config?: LinkedSelectConfig;
4
+ modelValue?: any[];
5
+ disabled?: boolean;
6
+ componentProps?: Record<string, any>;
7
+ }
8
+ declare function __VLS_template(): {
9
+ attrs: Partial<{}>;
10
+ slots: {
11
+ prefix?(_: {}): any;
12
+ suffix?(_: {}): any;
13
+ };
14
+ refs: {};
15
+ rootEl: HTMLDivElement;
16
+ };
17
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
18
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
19
+ "update:modelValue": (value: any[]) => any;
20
+ }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
21
+ "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
22
+ }>, {
23
+ modelValue: any[];
24
+ disabled: boolean;
25
+ config: LinkedSelectConfig;
26
+ componentProps: Record<string, any>;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
28
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
29
+ export default _default;
30
+ type __VLS_WithTemplateSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,146 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __async = (__this, __arguments, generator) => {
21
+ return new Promise((resolve, reject) => {
22
+ var fulfilled = (value) => {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e) {
26
+ reject(e);
27
+ }
28
+ };
29
+ var rejected = (value) => {
30
+ try {
31
+ step(generator.throw(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
+ step((generator = generator.apply(__this, __arguments)).next());
38
+ });
39
+ };
40
+ import { defineComponent, ref, onMounted, watch, openBlock, createElementBlock, renderSlot, Fragment, renderList, createBlock, unref, mergeProps, withCtx } from "vue";
41
+ import { ElSelect } from "element-plus";
42
+ const _hoisted_1 = { class: "flex gap-2" };
43
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
44
+ name: "JkyLinkedSelect"
45
+ }), {
46
+ __name: "LinkedSelect",
47
+ props: {
48
+ config: { default: void 0 },
49
+ modelValue: { default: () => [] },
50
+ disabled: { type: Boolean, default: false },
51
+ componentProps: { default: void 0 }
52
+ },
53
+ emits: ["update:modelValue"],
54
+ setup(__props, { emit: __emit }) {
55
+ const props = __props;
56
+ const emit = __emit;
57
+ const linkedSelectOptions = ref([]);
58
+ const linkedSelectLoading = ref([]);
59
+ function loadLinkedSelectOptions() {
60
+ return __async(this, null, function* () {
61
+ if (!props.config) {
62
+ return;
63
+ }
64
+ const level = props.config.level || 1;
65
+ linkedSelectLoading.value = Array.from({ length: level }, () => false);
66
+ if (props.config.getAllOptions) {
67
+ try {
68
+ const allOptions = yield props.config.getAllOptions(props.modelValue);
69
+ linkedSelectOptions.value = allOptions;
70
+ } catch (error) {
71
+ console.error("Failed to load linked select options:", error);
72
+ linkedSelectOptions.value = Array.from({ length: level }, () => []);
73
+ }
74
+ return;
75
+ }
76
+ if (props.config.getOptions) {
77
+ try {
78
+ const options = [];
79
+ for (let i = 0; i < level; i++) {
80
+ linkedSelectLoading.value[i] = true;
81
+ const levelOptions = yield props.config.getOptions(i + 1, props.modelValue || []);
82
+ options.push(levelOptions);
83
+ linkedSelectLoading.value[i] = false;
84
+ }
85
+ linkedSelectOptions.value = options;
86
+ } catch (error) {
87
+ console.error("Failed to load linked select options:", error);
88
+ linkedSelectOptions.value = Array.from({ length: level }, () => []);
89
+ }
90
+ }
91
+ });
92
+ }
93
+ onMounted(() => {
94
+ loadLinkedSelectOptions();
95
+ });
96
+ watch(
97
+ () => props.modelValue,
98
+ () => {
99
+ loadLinkedSelectOptions();
100
+ },
101
+ { deep: true }
102
+ );
103
+ function handleValueChange(index, val) {
104
+ const newValue = Array.isArray(props.modelValue) ? [...props.modelValue] : [];
105
+ newValue[index] = val;
106
+ emit("update:modelValue", newValue);
107
+ }
108
+ return (_ctx, _cache) => {
109
+ var _a;
110
+ return openBlock(), createElementBlock("div", _hoisted_1, [
111
+ renderSlot(_ctx.$slots, "prefix"),
112
+ (openBlock(true), createElementBlock(Fragment, null, renderList(Array.from({ length: ((_a = __props.config) == null ? void 0 : _a.level) || 1 }), (_, index) => {
113
+ var _a2, _b, _c, _d, _e, _f;
114
+ return openBlock(), createBlock(unref(ElSelect), mergeProps({
115
+ key: index,
116
+ "model-value": Array.isArray(__props.modelValue) ? __props.modelValue[index] : void 0,
117
+ placeholder: ((_b = (_a2 = __props.config) == null ? void 0 : _a2.placeholders) == null ? void 0 : _b[index]) || "请选择",
118
+ disabled: __props.disabled,
119
+ filterable: (_d = (_c = __props.config) == null ? void 0 : _c.filterable) != null ? _d : false,
120
+ clearable: (_f = (_e = __props.config) == null ? void 0 : _e.clearable) != null ? _f : true,
121
+ loading: linkedSelectLoading.value[index],
122
+ class: "flex-1 min-w-30"
123
+ }, { ref_for: true }, __props.componentProps, {
124
+ "onUpdate:modelValue": ($event) => handleValueChange(index, $event)
125
+ }), {
126
+ default: withCtx(() => [
127
+ (openBlock(true), createElementBlock(Fragment, null, renderList(linkedSelectOptions.value[index] || [], (option) => {
128
+ return openBlock(), createBlock(unref(ElSelect).Option, {
129
+ key: option.value,
130
+ value: option.value,
131
+ label: option.label,
132
+ disabled: option.disabled
133
+ }, null, 8, ["value", "label", "disabled"]);
134
+ }), 128))
135
+ ]),
136
+ _: 2
137
+ }, 1040, ["model-value", "placeholder", "disabled", "filterable", "clearable", "loading", "onUpdate:modelValue"]);
138
+ }), 128)),
139
+ renderSlot(_ctx.$slots, "suffix")
140
+ ]);
141
+ };
142
+ }
143
+ }));
144
+ export {
145
+ _sfc_main as default
146
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./LinkedSelect.vue.js";
2
+ /* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -1,5 +1,7 @@
1
1
  import { InstallWithSFC } from '../utils';
2
2
  import { default as Form } from './Form.vue';
3
- export type { ComponentPropsMap, ComponentPropsType, DynamicComponentProps, FormComponentType, FormItemChildConfig, FormItemConfig, FormItemOption, FormItemProps, FormItemPropsContext, FormProps, FormValidateResult, GridConfig, HelpConfig, HelpType, ResponsiveBreakpoint, ResponsiveConfig, SelectTableComponentProps, SelectTableProps, StaticComponentProps, } from './types';
3
+ import { default as LinkedSelect } from './LinkedSelect.vue';
4
+ export type { ComponentPropsMap, ComponentPropsType, DynamicComponentProps, FormComponentType, FormItemChildConfig, FormItemConfig, FormItemOption, FormItemProps, FormItemPropsContext, FormProps, FormValidateResult, GridConfig, HelpConfig, HelpType, LinkedSelectConfig, ResponsiveBreakpoint, ResponsiveConfig, SelectTableComponentProps, SelectTableProps, StaticComponentProps, } from './types';
4
5
  export declare const JkyForm: InstallWithSFC<typeof Form>;
6
+ export declare const JkyLinkedSelect: InstallWithSFC<typeof LinkedSelect>;
5
7
  export default JkyForm;
@@ -1,8 +1,12 @@
1
1
  import _sfc_main from "./Form.vue.js";
2
2
  /* empty css */
3
+ import _sfc_main$1 from "./LinkedSelect.vue.js";
4
+ /* empty css */
3
5
  import { installWithSFC } from "../utils/with-install.js";
4
6
  const JkyForm = installWithSFC(_sfc_main);
7
+ const JkyLinkedSelect = installWithSFC(_sfc_main$1);
5
8
  export {
6
9
  JkyForm,
10
+ JkyLinkedSelect,
7
11
  JkyForm as default
8
12
  };
package/dist/es/index.js CHANGED
@@ -12,7 +12,7 @@ import { JkyAddInput } from "./add-input/index.js";
12
12
  import { JkyButton } from "./button/index.js";
13
13
  import { JkyButtonNav } from "./button-nav/index.js";
14
14
  import { JkyCodeMirrorEditor } from "./code-mirror-editor/index.js";
15
- import { JkyForm } from "./form/index.js";
15
+ import { JkyForm, JkyLinkedSelect } from "./form/index.js";
16
16
  import { JkyMenu } from "./menu/index.js";
17
17
  import { JkyModal } from "./modal/index.js";
18
18
  import { JkyPageHeader } from "./page-header/index.js";
@@ -39,6 +39,7 @@ export {
39
39
  JkyCodeMirrorEditor,
40
40
  JkyComponentLibResolver,
41
41
  JkyForm,
42
+ JkyLinkedSelect,
42
43
  JkyMenu,
43
44
  JkyModal,
44
45
  JkyPageHeader,
@@ -1,4 +1,4 @@
1
- const version = "0.0.125";
1
+ const version = "0.0.126";
2
2
  export {
3
3
  version
4
4
  };
@@ -5,7 +5,7 @@ declare const _default: import('vue').DefineComponent<ActionColumnProps, {}, {},
5
5
  onClick?: ((button: ActionColumnButtonConfig, row: any, index: number) => any) | undefined;
6
6
  }>, {
7
7
  index: number;
8
- row: any;
9
8
  config: ActionColumnConfig;
9
+ row: any;
10
10
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
11
11
  export default _default;
@@ -86,7 +86,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
86
86
  disabled: button.disabled,
87
87
  icon: button.icon,
88
88
  plain: button.plain,
89
- class: normalizeClass(button.class),
89
+ class: normalizeClass(["ml-0!", button.class]),
90
90
  text: "",
91
91
  onClick: ($event) => handleButtonClick(button)
92
92
  }, {
@@ -2812,6 +2812,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
2812
2812
  }>, {
2813
2813
  title: string;
2814
2814
  loading: boolean;
2815
+ emptyText: string;
2815
2816
  toolbarButtonLimit: number;
2816
2817
  withCard: boolean;
2817
2818
  filterItems: import('./types').FilterItemConfig[];
@@ -2825,7 +2826,6 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
2825
2826
  selectedRows: any[];
2826
2827
  border: boolean;
2827
2828
  stripe: boolean;
2828
- emptyText: string;
2829
2829
  formProps: Partial<import('../form').FormProps>;
2830
2830
  tableProps: Partial<import('element-plus').TableProps>;
2831
2831
  paginationProps: Partial<import('element-plus').PaginationProps>;
@@ -37,13 +37,13 @@ declare const _default: import('vue').DefineComponent<PageTableV2Props, {
37
37
  }>, {
38
38
  title: string;
39
39
  loading: boolean;
40
+ emptyText: string;
40
41
  toolbarButtonLimit: number;
41
42
  withCard: boolean;
42
43
  filterItems: import('../form').FormProps["items"];
43
44
  showSearchButton: boolean;
44
45
  searchText: string;
45
46
  resetText: string;
46
- emptyText: string;
47
47
  formProps: Partial<import('../form').FormProps>;
48
48
  tableProps: Partial<import('element-plus').TableV2Props<any>>;
49
49
  autoSearchDelay: number;
package/dist/es/style.css CHANGED
@@ -1854,6 +1854,10 @@
1854
1854
  min-width: calc(var(--spacing) * 25);
1855
1855
  }
1856
1856
 
1857
+ .min-w-30 {
1858
+ min-width: calc(var(--spacing) * 30);
1859
+ }
1860
+
1857
1861
  .flex-1 {
1858
1862
  flex: 1;
1859
1863
  }
@@ -1,3 +1,14 @@
1
+ /* AMap 高德地图组件样式 */
2
+ .jky-amap-container {
3
+ /* 地图容器样式 */
4
+ position: relative;
5
+ overflow: hidden;
1
6
 
2
- /* 轨迹回放组件不需要额外样式 */
3
- /* 所有样式通过 TailwindCSS 工具类或外部组件控制 */
7
+ /* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
8
+ .amap-logo {
9
+ display: none !important;
10
+ }
11
+ .amap-copyright {
12
+ display: none !important;
13
+ }
14
+ }
@@ -1,14 +1,3 @@
1
- /* AMap 高德地图组件样式 */
2
- .jky-amap-container {
3
- /* 地图容器样式 */
4
- position: relative;
5
- overflow: hidden;
6
1
 
7
- /* 隐藏高德地图的 logo 和版权信息(注意:商业使用请遵守高德地图条款) */
8
- .amap-logo {
9
- display: none !important;
10
- }
11
- .amap-copyright {
12
- display: none !important;
13
- }
14
- }
2
+ /* 轨迹回放组件不需要额外样式 */
3
+ /* 所有样式通过 TailwindCSS 工具类或外部组件控制 */
@@ -22,6 +22,7 @@ const components = [
22
22
  index$9.JkyPageHeader,
23
23
  index$7.JkyMenu,
24
24
  index$6.JkyForm,
25
+ index$6.JkyLinkedSelect,
25
26
  index$5.JkyCodeMirrorEditor,
26
27
  index$2.JkyAddInput,
27
28
  index$c.JkyRichEditor,
@@ -40,6 +41,7 @@ exports.JkyButton = index$3.JkyButton;
40
41
  exports.JkyButtonNav = index$4.JkyButtonNav;
41
42
  exports.JkyCodeMirrorEditor = index$5.JkyCodeMirrorEditor;
42
43
  exports.JkyForm = index$6.JkyForm;
44
+ exports.JkyLinkedSelect = index$6.JkyLinkedSelect;
43
45
  exports.JkyMenu = index$7.JkyMenu;
44
46
  exports.JkyModal = index$8.JkyModal;
45
47
  exports.JkyPageHeader = index$9.JkyPageHeader;
@@ -57,6 +57,8 @@ const ElementPlus = require("element-plus");
57
57
  const index = require("../add-input/index.js");
58
58
  const index$2 = require("../code-mirror-editor/index.js");
59
59
  const index$1 = require("../rich-editor/index.js");
60
+ const LinkedSelect_vue_vue_type_script_setup_true_lang = require("./LinkedSelect.vue.js");
61
+ ;/* empty css */
60
62
  const SelectTable_vue_vue_type_script_setup_true_lang = require("./SelectTable.vue.js");
61
63
  ;/* empty css */
62
64
  const _hoisted_1 = {
@@ -161,14 +163,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
161
163
  rules.value = configRules;
162
164
  });
163
165
  }
164
- vue.watch(
165
- () => props.model,
166
- () => {
167
- loadComponentProps();
168
- loadRules();
169
- },
170
- { deep: true }
171
- );
172
166
  loadComponentProps();
173
167
  loadRules();
174
168
  const modelValue = vue.computed({
@@ -177,6 +171,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
177
171
  props.model[props.field] = val;
178
172
  }
179
173
  });
174
+ vue.watch(
175
+ () => props.model,
176
+ () => {
177
+ loadComponentProps();
178
+ loadRules();
179
+ },
180
+ { deep: true }
181
+ );
180
182
  const isHidden = vue.computed(() => {
181
183
  if (typeof props.config.hidden === "function") {
182
184
  return props.config.hidden({
@@ -492,6 +494,17 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
492
494
  const addInputProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
493
495
  return vue.h(index.JkyAddInput, addInputProps, _componentSlotsObj);
494
496
  }
497
+ // 联动下拉框
498
+ case "linked-select":
499
+ return vue.h(LinkedSelect_vue_vue_type_script_setup_true_lang.default, {
500
+ "config": props.config.config,
501
+ "modelValue": modelValue.value,
502
+ "disabled": props.disabled,
503
+ "componentProps": componentProps.value,
504
+ "onUpdate:modelValue": (val) => {
505
+ props.model[props.field] = val;
506
+ }
507
+ }, _componentSlotsObj);
495
508
  case "custom":
496
509
  return (_b = (_a = props.config).render) == null ? void 0 : _b.call(_a, commonProps);
497
510
  default:
@@ -0,0 +1,34 @@
1
+ import { LinkedSelectConfig } from './types';
2
+ interface Props {
3
+ config?: LinkedSelectConfig;
4
+ modelValue?: any[];
5
+ disabled?: boolean;
6
+ componentProps?: Record<string, any>;
7
+ }
8
+ declare function __VLS_template(): {
9
+ attrs: Partial<{}>;
10
+ slots: {
11
+ prefix?(_: {}): any;
12
+ suffix?(_: {}): any;
13
+ };
14
+ refs: {};
15
+ rootEl: HTMLDivElement;
16
+ };
17
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
18
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
19
+ "update:modelValue": (value: any[]) => any;
20
+ }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
21
+ "onUpdate:modelValue"?: ((value: any[]) => any) | undefined;
22
+ }>, {
23
+ modelValue: any[];
24
+ disabled: boolean;
25
+ config: LinkedSelectConfig;
26
+ componentProps: Record<string, any>;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
28
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
29
+ export default _default;
30
+ type __VLS_WithTemplateSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __async = (__this, __arguments, generator) => {
22
+ return new Promise((resolve, reject) => {
23
+ var fulfilled = (value) => {
24
+ try {
25
+ step(generator.next(value));
26
+ } catch (e) {
27
+ reject(e);
28
+ }
29
+ };
30
+ var rejected = (value) => {
31
+ try {
32
+ step(generator.throw(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
+ step((generator = generator.apply(__this, __arguments)).next());
39
+ });
40
+ };
41
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
42
+ const vue = require("vue");
43
+ const ElementPlus = require("element-plus");
44
+ const _hoisted_1 = { class: "flex gap-2" };
45
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
46
+ name: "JkyLinkedSelect"
47
+ }), {
48
+ __name: "LinkedSelect",
49
+ props: {
50
+ config: { default: void 0 },
51
+ modelValue: { default: () => [] },
52
+ disabled: { type: Boolean, default: false },
53
+ componentProps: { default: void 0 }
54
+ },
55
+ emits: ["update:modelValue"],
56
+ setup(__props, { emit: __emit }) {
57
+ const props = __props;
58
+ const emit = __emit;
59
+ const linkedSelectOptions = vue.ref([]);
60
+ const linkedSelectLoading = vue.ref([]);
61
+ function loadLinkedSelectOptions() {
62
+ return __async(this, null, function* () {
63
+ if (!props.config) {
64
+ return;
65
+ }
66
+ const level = props.config.level || 1;
67
+ linkedSelectLoading.value = Array.from({ length: level }, () => false);
68
+ if (props.config.getAllOptions) {
69
+ try {
70
+ const allOptions = yield props.config.getAllOptions(props.modelValue);
71
+ linkedSelectOptions.value = allOptions;
72
+ } catch (error) {
73
+ console.error("Failed to load linked select options:", error);
74
+ linkedSelectOptions.value = Array.from({ length: level }, () => []);
75
+ }
76
+ return;
77
+ }
78
+ if (props.config.getOptions) {
79
+ try {
80
+ const options = [];
81
+ for (let i = 0; i < level; i++) {
82
+ linkedSelectLoading.value[i] = true;
83
+ const levelOptions = yield props.config.getOptions(i + 1, props.modelValue || []);
84
+ options.push(levelOptions);
85
+ linkedSelectLoading.value[i] = false;
86
+ }
87
+ linkedSelectOptions.value = options;
88
+ } catch (error) {
89
+ console.error("Failed to load linked select options:", error);
90
+ linkedSelectOptions.value = Array.from({ length: level }, () => []);
91
+ }
92
+ }
93
+ });
94
+ }
95
+ vue.onMounted(() => {
96
+ loadLinkedSelectOptions();
97
+ });
98
+ vue.watch(
99
+ () => props.modelValue,
100
+ () => {
101
+ loadLinkedSelectOptions();
102
+ },
103
+ { deep: true }
104
+ );
105
+ function handleValueChange(index, val) {
106
+ const newValue = Array.isArray(props.modelValue) ? [...props.modelValue] : [];
107
+ newValue[index] = val;
108
+ emit("update:modelValue", newValue);
109
+ }
110
+ return (_ctx, _cache) => {
111
+ var _a;
112
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
113
+ vue.renderSlot(_ctx.$slots, "prefix"),
114
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(Array.from({ length: ((_a = __props.config) == null ? void 0 : _a.level) || 1 }), (_, index) => {
115
+ var _a2, _b, _c, _d, _e, _f;
116
+ return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElSelect), vue.mergeProps({
117
+ key: index,
118
+ "model-value": Array.isArray(__props.modelValue) ? __props.modelValue[index] : void 0,
119
+ placeholder: ((_b = (_a2 = __props.config) == null ? void 0 : _a2.placeholders) == null ? void 0 : _b[index]) || "请选择",
120
+ disabled: __props.disabled,
121
+ filterable: (_d = (_c = __props.config) == null ? void 0 : _c.filterable) != null ? _d : false,
122
+ clearable: (_f = (_e = __props.config) == null ? void 0 : _e.clearable) != null ? _f : true,
123
+ loading: linkedSelectLoading.value[index],
124
+ class: "flex-1 min-w-30"
125
+ }, { ref_for: true }, __props.componentProps, {
126
+ "onUpdate:modelValue": ($event) => handleValueChange(index, $event)
127
+ }), {
128
+ default: vue.withCtx(() => [
129
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(linkedSelectOptions.value[index] || [], (option) => {
130
+ return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElSelect).Option, {
131
+ key: option.value,
132
+ value: option.value,
133
+ label: option.label,
134
+ disabled: option.disabled
135
+ }, null, 8, ["value", "label", "disabled"]);
136
+ }), 128))
137
+ ]),
138
+ _: 2
139
+ }, 1040, ["model-value", "placeholder", "disabled", "filterable", "clearable", "loading", "onUpdate:modelValue"]);
140
+ }), 128)),
141
+ vue.renderSlot(_ctx.$slots, "suffix")
142
+ ]);
143
+ };
144
+ }
145
+ }));
146
+ exports.default = _sfc_main;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const LinkedSelect_vue_vue_type_script_setup_true_lang = require("./LinkedSelect.vue.js");
4
+ ;/* empty css */
5
+ exports.default = LinkedSelect_vue_vue_type_script_setup_true_lang.default;
@@ -1,5 +1,7 @@
1
1
  import { InstallWithSFC } from '../utils';
2
2
  import { default as Form } from './Form.vue';
3
- export type { ComponentPropsMap, ComponentPropsType, DynamicComponentProps, FormComponentType, FormItemChildConfig, FormItemConfig, FormItemOption, FormItemProps, FormItemPropsContext, FormProps, FormValidateResult, GridConfig, HelpConfig, HelpType, ResponsiveBreakpoint, ResponsiveConfig, SelectTableComponentProps, SelectTableProps, StaticComponentProps, } from './types';
3
+ import { default as LinkedSelect } from './LinkedSelect.vue';
4
+ export type { ComponentPropsMap, ComponentPropsType, DynamicComponentProps, FormComponentType, FormItemChildConfig, FormItemConfig, FormItemOption, FormItemProps, FormItemPropsContext, FormProps, FormValidateResult, GridConfig, HelpConfig, HelpType, LinkedSelectConfig, ResponsiveBreakpoint, ResponsiveConfig, SelectTableComponentProps, SelectTableProps, StaticComponentProps, } from './types';
4
5
  export declare const JkyForm: InstallWithSFC<typeof Form>;
6
+ export declare const JkyLinkedSelect: InstallWithSFC<typeof LinkedSelect>;
5
7
  export default JkyForm;
@@ -2,7 +2,11 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const Form_vue_vue_type_script_setup_true_lang = require("./Form.vue.js");
4
4
  ;/* empty css */
5
+ const LinkedSelect_vue_vue_type_script_setup_true_lang = require("./LinkedSelect.vue.js");
6
+ ;/* empty css */
5
7
  const withInstall = require("../utils/with-install.js");
6
8
  const JkyForm = withInstall.installWithSFC(Form_vue_vue_type_script_setup_true_lang.default);
9
+ const JkyLinkedSelect = withInstall.installWithSFC(LinkedSelect_vue_vue_type_script_setup_true_lang.default);
7
10
  exports.JkyForm = JkyForm;
11
+ exports.JkyLinkedSelect = JkyLinkedSelect;
8
12
  exports.default = JkyForm;
package/dist/lib/index.js CHANGED
@@ -43,6 +43,7 @@ exports.JkyButton = index$3.JkyButton;
43
43
  exports.JkyButtonNav = index$4.JkyButtonNav;
44
44
  exports.JkyCodeMirrorEditor = index$5.JkyCodeMirrorEditor;
45
45
  exports.JkyForm = index$6.JkyForm;
46
+ exports.JkyLinkedSelect = index$6.JkyLinkedSelect;
46
47
  exports.JkyMenu = index$7.JkyMenu;
47
48
  exports.JkyModal = index$8.JkyModal;
48
49
  exports.JkyPageHeader = index$9.JkyPageHeader;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const version = "0.0.125";
3
+ const version = "0.0.126";
4
4
  exports.version = version;
@@ -5,7 +5,7 @@ declare const _default: import('vue').DefineComponent<ActionColumnProps, {}, {},
5
5
  onClick?: ((button: ActionColumnButtonConfig, row: any, index: number) => any) | undefined;
6
6
  }>, {
7
7
  index: number;
8
- row: any;
9
8
  config: ActionColumnConfig;
9
+ row: any;
10
10
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
11
11
  export default _default;
@@ -88,7 +88,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValu
88
88
  disabled: button.disabled,
89
89
  icon: button.icon,
90
90
  plain: button.plain,
91
- class: vue.normalizeClass(button.class),
91
+ class: vue.normalizeClass(["ml-0!", button.class]),
92
92
  text: "",
93
93
  onClick: ($event) => handleButtonClick(button)
94
94
  }, {
@@ -2812,6 +2812,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
2812
2812
  }>, {
2813
2813
  title: string;
2814
2814
  loading: boolean;
2815
+ emptyText: string;
2815
2816
  toolbarButtonLimit: number;
2816
2817
  withCard: boolean;
2817
2818
  filterItems: import('./types').FilterItemConfig[];
@@ -2825,7 +2826,6 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
2825
2826
  selectedRows: any[];
2826
2827
  border: boolean;
2827
2828
  stripe: boolean;
2828
- emptyText: string;
2829
2829
  formProps: Partial<import('../form').FormProps>;
2830
2830
  tableProps: Partial<import('element-plus').TableProps>;
2831
2831
  paginationProps: Partial<import('element-plus').PaginationProps>;
@@ -37,13 +37,13 @@ declare const _default: import('vue').DefineComponent<PageTableV2Props, {
37
37
  }>, {
38
38
  title: string;
39
39
  loading: boolean;
40
+ emptyText: string;
40
41
  toolbarButtonLimit: number;
41
42
  withCard: boolean;
42
43
  filterItems: import('../form').FormProps["items"];
43
44
  showSearchButton: boolean;
44
45
  searchText: string;
45
46
  resetText: string;
46
- emptyText: string;
47
47
  formProps: Partial<import('../form').FormProps>;
48
48
  tableProps: Partial<import('element-plus').TableV2Props<any>>;
49
49
  autoSearchDelay: number;
@@ -1854,6 +1854,10 @@
1854
1854
  min-width: calc(var(--spacing) * 25);
1855
1855
  }
1856
1856
 
1857
+ .min-w-30 {
1858
+ min-width: calc(var(--spacing) * 30);
1859
+ }
1860
+
1857
1861
  .flex-1 {
1858
1862
  flex: 1;
1859
1863
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jky-component-lib",
3
3
  "type": "module",
4
- "version": "0.0.125",
4
+ "version": "0.0.126",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },