jky-component-lib 0.0.61 → 0.0.65

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 (49) hide show
  1. package/dist/es/components.d.ts +1 -0
  2. package/dist/es/components.js +4 -1
  3. package/dist/es/form/Form.vue.d.ts +11 -7
  4. package/dist/es/form/Form.vue.js +144 -40
  5. package/dist/es/form/FormItem.vue.js +76 -14
  6. package/dist/es/form/SelectTable.vue.d.ts +38 -0
  7. package/dist/es/form/SelectTable.vue.js +217 -0
  8. package/dist/es/form/SelectTable.vue3.js +5 -0
  9. package/dist/es/form/style.css +56 -0
  10. package/dist/es/index.js +2 -0
  11. package/dist/es/package.json.js +1 -1
  12. package/dist/es/page-layout/PageLayout.vue.d.ts +36 -0
  13. package/dist/es/page-layout/PageLayout.vue.js +152 -0
  14. package/dist/es/page-layout/PageLayout.vue3.js +5 -0
  15. package/dist/es/page-layout/index.d.ts +4 -0
  16. package/dist/es/page-layout/index.js +8 -0
  17. package/dist/es/page-layout/style.css +10 -0
  18. package/dist/es/page-table/PageTable.vue.d.ts +61 -293
  19. package/dist/es/page-table/PageTable.vue.js +216 -116
  20. package/dist/es/page-table/Toolbar.vue.d.ts +1 -0
  21. package/dist/es/page-table/Toolbar.vue.js +40 -10
  22. package/dist/es/page-table/style.css +7 -1
  23. package/dist/es/style.css +350 -82
  24. package/dist/es/styles.css +1 -1
  25. package/dist/lib/components.d.ts +1 -0
  26. package/dist/lib/components.js +12 -9
  27. package/dist/lib/form/Form.vue.d.ts +11 -7
  28. package/dist/lib/form/Form.vue.js +142 -38
  29. package/dist/lib/form/FormItem.vue.js +75 -13
  30. package/dist/lib/form/SelectTable.vue.d.ts +38 -0
  31. package/dist/lib/form/SelectTable.vue.js +217 -0
  32. package/dist/lib/form/SelectTable.vue3.js +5 -0
  33. package/dist/lib/form/style.css +56 -0
  34. package/dist/lib/index.js +8 -6
  35. package/dist/lib/package.json.js +1 -1
  36. package/dist/lib/page-layout/PageLayout.vue.d.ts +36 -0
  37. package/dist/lib/page-layout/PageLayout.vue.js +152 -0
  38. package/dist/lib/page-layout/PageLayout.vue3.js +5 -0
  39. package/dist/lib/page-layout/index.d.ts +4 -0
  40. package/dist/lib/page-layout/index.js +8 -0
  41. package/dist/lib/page-layout/style.css +10 -0
  42. package/dist/lib/page-table/PageTable.vue.d.ts +61 -293
  43. package/dist/lib/page-table/PageTable.vue.js +214 -114
  44. package/dist/lib/page-table/Toolbar.vue.d.ts +1 -0
  45. package/dist/lib/page-table/Toolbar.vue.js +38 -8
  46. package/dist/lib/page-table/style.css +7 -1
  47. package/dist/lib/style.css +350 -82
  48. package/dist/lib/styles.css +1 -1
  49. package/package.json +1 -1
@@ -6,6 +6,7 @@ export * from './code-mirror-editor';
6
6
  export * from './form';
7
7
  export * from './menu';
8
8
  export * from './page-header';
9
+ export * from './page-layout';
9
10
  export * from './page-table';
10
11
  export * from './rich-editor';
11
12
  export * from './say-hello';
@@ -5,6 +5,7 @@ import { JkyCodeMirrorEditor } from "./code-mirror-editor/index.js";
5
5
  import { JkyForm } from "./form/index.js";
6
6
  import { JkyMenu } from "./menu/index.js";
7
7
  import { JkyPageHeader } from "./page-header/index.js";
8
+ import { JkyPageLayout } from "./page-layout/index.js";
8
9
  import { JkyPageTable } from "./page-table/index.js";
9
10
  import { JkyRichEditor } from "./rich-editor/index.js";
10
11
  import { JkySayHello } from "./say-hello/index.js";
@@ -18,7 +19,8 @@ const components = [
18
19
  JkyCodeMirrorEditor,
19
20
  JkyAddInput,
20
21
  JkyRichEditor,
21
- JkyPageTable
22
+ JkyPageTable,
23
+ JkyPageLayout
22
24
  ];
23
25
  export {
24
26
  JkyAddInput,
@@ -28,6 +30,7 @@ export {
28
30
  JkyForm,
29
31
  JkyMenu,
30
32
  JkyPageHeader,
33
+ JkyPageLayout,
31
34
  JkyPageTable,
32
35
  JkyRichEditor,
33
36
  JkySayHello,
@@ -88,7 +88,7 @@ declare function getFormInstance(): ({
88
88
  validateOnRuleChange: boolean;
89
89
  }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
90
90
  onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
91
- }>, "labelWidth" | "labelPosition" | "showMessage" | "validate" | "clearValidate" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
91
+ }>, "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
92
92
  validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
93
93
  validateField: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
94
94
  resetFields: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
@@ -195,7 +195,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
195
195
  validateOnRuleChange: boolean;
196
196
  }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
197
197
  onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
198
- }>, "labelWidth" | "labelPosition" | "showMessage" | "validate" | "clearValidate" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
198
+ }>, "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
199
199
  validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
200
200
  validateField: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
201
201
  resetFields: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
@@ -293,7 +293,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
293
293
  validateOnRuleChange: boolean;
294
294
  }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
295
295
  onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
296
- }>, "labelWidth" | "labelPosition" | "showMessage" | "validate" | "clearValidate" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
296
+ }>, "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
297
297
  validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
298
298
  validateField: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
299
299
  resetFields: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
@@ -327,16 +327,20 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
327
327
  }) => any) | undefined;
328
328
  }>, {
329
329
  size: import('element-plus').ComponentSize;
330
- labelWidth: string | number;
330
+ grid: import('./types').GridConfig;
331
+ inline: boolean;
331
332
  labelPosition: "left" | "right" | "top";
332
- showFooter: boolean;
333
+ labelWidth: string | number;
333
334
  showTitle: boolean;
334
335
  gutter: number;
335
336
  defaultSpan: number;
336
337
  responsive: boolean;
337
338
  watchDeep: boolean;
339
+ showFooter: boolean;
340
+ footerClass: string;
338
341
  submitText: string;
339
342
  cancelText: string;
343
+ showCount: number;
340
344
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
341
345
  formRef: ({
342
346
  $: import('vue').ComponentInternalInstance;
@@ -423,7 +427,7 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
423
427
  validateOnRuleChange: boolean;
424
428
  }> & Omit<Readonly<import('element-plus').FormProps> & Readonly<{
425
429
  onValidate?: ((prop: import('element-plus').FormItemProp, isValid: boolean, message: string) => any) | undefined;
426
- }>, "labelWidth" | "labelPosition" | "showMessage" | "validate" | "clearValidate" | "requireAsteriskPosition" | "labelSuffix" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validateField" | "resetFields" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
430
+ }>, "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & import('vue').ShallowUnwrapRef<{
427
431
  validate: (callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
428
432
  validateField: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>, callback?: import('element-plus').FormValidateCallback) => import('element-plus').FormValidationResult;
429
433
  resetFields: (props?: import('element-plus/es/utils').Arrayable<import('element-plus').FormItemProp>) => void;
@@ -437,5 +441,5 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
437
441
  default?: (props: {}) => any;
438
442
  };
439
443
  }) | null;
440
- }, HTMLDivElement>;
444
+ }, any>;
441
445
  export default _default;
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
20
32
  var __async = (__this, __arguments, generator) => {
21
33
  return new Promise((resolve, reject) => {
22
34
  var fulfilled = (value) => {
@@ -37,20 +49,17 @@ var __async = (__this, __arguments, generator) => {
37
49
  step((generator = generator.apply(__this, __arguments)).next());
38
50
  });
39
51
  };
40
- import { defineComponent, useModel, ref, computed, watch, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createVNode, unref, mergeProps, withCtx, Fragment, renderList, createBlock, createTextVNode, mergeModels } from "vue";
41
- import { ElForm, ElButton } from "element-plus";
52
+ import { defineComponent, useModel, provide, ref, useAttrs, computed, watch, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createVNode, unref, mergeProps, withCtx, Fragment, renderList, createBlock, createElementVNode, createTextVNode, mergeModels } from "vue";
53
+ import { ElForm, ElFormItem, ElButton } from "element-plus";
42
54
  import _sfc_main$1 from "./FormItem.vue.js";
43
55
  /* empty css */
44
56
  const _hoisted_1 = {
45
57
  key: 0,
46
58
  class: "jky-form__title mb-4 text-xl font-semibold"
47
59
  };
48
- const _hoisted_2 = {
49
- key: 1,
50
- class: "jky-form__footer mt-6 flex justify-end gap-2"
51
- };
52
60
  const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
53
- name: "JkyForm"
61
+ name: "JkyForm",
62
+ inheritAttrs: false
54
63
  }), {
55
64
  __name: "Form",
56
65
  props: /* @__PURE__ */ mergeModels({
@@ -61,15 +70,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
61
70
  gutter: { default: 0 },
62
71
  defaultSpan: { default: 24 },
63
72
  responsive: { type: Boolean, default: true },
73
+ grid: { type: [Boolean, Object], default: false },
64
74
  className: {},
65
75
  readonly: { type: Boolean },
66
76
  disabled: { type: Boolean },
67
77
  watchDeep: { type: Boolean, default: true },
68
- showFooter: { type: Boolean, default: false },
78
+ showFooter: { type: Boolean, default: true },
79
+ footerClass: { default: "" },
69
80
  submitText: { default: "提交" },
70
81
  cancelText: { default: "取消" },
71
82
  submitDisabled: { type: Boolean },
72
83
  cancelDisabled: { type: Boolean },
84
+ showCount: { default: 999 },
73
85
  onValidate: {},
74
86
  onSubmit: {},
75
87
  onReset: {},
@@ -79,7 +91,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
79
91
  requireAsteriskPosition: {},
80
92
  labelWidth: { default: "100" },
81
93
  labelSuffix: {},
82
- inline: { type: Boolean },
94
+ inline: { type: Boolean, default: false },
83
95
  inlineMessage: { type: Boolean },
84
96
  statusIcon: { type: Boolean },
85
97
  showMessage: { type: Boolean },
@@ -97,13 +109,83 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
97
109
  const props = __props;
98
110
  const emit = __emit;
99
111
  const modelValue = useModel(__props, "modelValue");
112
+ provide("formModel", modelValue);
100
113
  const formRef = ref();
114
+ const attrs = useAttrs();
115
+ const JKY_FORM_PROPS = [
116
+ "modelValue",
117
+ "items",
118
+ "showTitle",
119
+ "title",
120
+ "gutter",
121
+ "defaultSpan",
122
+ "responsive",
123
+ "readonly",
124
+ "disabled",
125
+ "watchDeep",
126
+ "showFooter",
127
+ "footerClass",
128
+ "submitText",
129
+ "cancelText",
130
+ "submitDisabled",
131
+ "cancelDisabled",
132
+ "onValidate",
133
+ "onSubmit",
134
+ "onReset",
135
+ "className",
136
+ "grid",
137
+ "showCount"
138
+ ];
139
+ const elFormProps = computed(() => {
140
+ const formProps = Object.fromEntries(
141
+ Object.entries(props).filter(([key]) => !JKY_FORM_PROPS.includes(key))
142
+ );
143
+ const _a = attrs, { class: _, style } = _a, restAttrs = __objRest(_a, ["class", "style"]);
144
+ return __spreadValues(__spreadValues({}, formProps), restAttrs);
145
+ });
101
146
  const formClass = computed(() => {
102
147
  return [
103
148
  "jky-form",
104
- props.className
149
+ attrs.class
105
150
  ].filter(Boolean).join(" ");
106
151
  });
152
+ const _elFormClass = computed(() => {
153
+ const classes = [];
154
+ if (props.inline && props.grid) {
155
+ classes.push("jky-form--grid");
156
+ }
157
+ return classes;
158
+ });
159
+ const _gridStyle = computed(() => {
160
+ if (!props.inline || !props.grid || typeof props.grid === "boolean") {
161
+ return {};
162
+ }
163
+ const style = {};
164
+ const breakpoints = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
165
+ breakpoints.forEach((breakpoint) => {
166
+ const columns = props.grid[breakpoint];
167
+ if (columns !== void 0) {
168
+ style[`--jky-form-grid-cols-${breakpoint}`] = columns;
169
+ }
170
+ });
171
+ return style;
172
+ });
173
+ const showAllItems = ref(false);
174
+ const visibleItems = computed(() => {
175
+ if (!props.items || props.items.length <= props.showCount) {
176
+ return props.items;
177
+ }
178
+ if (showAllItems.value) {
179
+ return props.items;
180
+ }
181
+ return props.items.slice(0, props.showCount);
182
+ });
183
+ const showMoreButton = computed(() => {
184
+ return props.items && props.items.length > props.showCount;
185
+ });
186
+ function toggleShowMore() {
187
+ showAllItems.value = !showAllItems.value;
188
+ }
107
189
  watch(
108
190
  () => props.modelValue,
109
191
  (newVal, oldVal) => {
@@ -170,14 +252,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
170
252
  __props.showTitle && __props.title ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
171
253
  createVNode(unref(ElForm), mergeProps({
172
254
  ref_key: "formRef",
173
- ref: formRef,
255
+ ref: formRef
256
+ }, elFormProps.value, {
174
257
  model: modelValue.value,
175
- "label-width": __props.labelWidth,
176
- "label-position": __props.labelPosition,
177
- size: __props.size
178
- }, _ctx.$attrs), {
258
+ class: _elFormClass.value,
259
+ style: _gridStyle.value
260
+ }), {
179
261
  default: withCtx(() => [
180
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
262
+ (openBlock(true), createElementBlock(Fragment, null, renderList(visibleItems.value, (item) => {
181
263
  return openBlock(), createBlock(_sfc_main$1, {
182
264
  key: item.field,
183
265
  field: item.field,
@@ -186,32 +268,54 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
186
268
  readonly: __props.readonly,
187
269
  disabled: __props.disabled
188
270
  }, null, 8, ["field", "config", "model", "readonly", "disabled"]);
189
- }), 128))
271
+ }), 128)),
272
+ showMoreButton.value || props.showFooter ? (openBlock(), createBlock(unref(ElFormItem), {
273
+ key: 0,
274
+ "label-width": 0
275
+ }, {
276
+ default: withCtx(() => [
277
+ createElementVNode("div", {
278
+ class: normalizeClass(["w-full flex gap-2", [props.grid && props.inline ? "justify-center" : "justify-end", props.footerClass]])
279
+ }, [
280
+ showMoreButton.value ? (openBlock(), createBlock(unref(ElButton), {
281
+ key: 0,
282
+ type: "primary",
283
+ onClick: toggleShowMore
284
+ }, {
285
+ default: withCtx(() => [
286
+ createTextVNode(toDisplayString(showAllItems.value ? "收起" : `展开 (${props.items.length - props.showCount})`), 1)
287
+ ]),
288
+ _: 1
289
+ })) : createCommentVNode("", true),
290
+ props.showFooter ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
291
+ createVNode(unref(ElButton), {
292
+ disabled: __props.cancelDisabled || __props.disabled,
293
+ onClick: handleCancel
294
+ }, {
295
+ default: withCtx(() => [
296
+ createTextVNode(toDisplayString(__props.cancelText), 1)
297
+ ]),
298
+ _: 1
299
+ }, 8, ["disabled"]),
300
+ createVNode(unref(ElButton), {
301
+ type: "primary",
302
+ disabled: __props.submitDisabled || __props.disabled,
303
+ loading: false,
304
+ onClick: handleSubmit
305
+ }, {
306
+ default: withCtx(() => [
307
+ createTextVNode(toDisplayString(__props.submitText), 1)
308
+ ]),
309
+ _: 1
310
+ }, 8, ["disabled"])
311
+ ], 64)) : createCommentVNode("", true)
312
+ ], 2)
313
+ ]),
314
+ _: 1
315
+ })) : createCommentVNode("", true)
190
316
  ]),
191
317
  _: 1
192
- }, 16, ["model", "label-width", "label-position", "size"]),
193
- props.showFooter ? (openBlock(), createElementBlock("div", _hoisted_2, [
194
- createVNode(unref(ElButton), {
195
- disabled: __props.cancelDisabled || __props.disabled,
196
- onClick: handleCancel
197
- }, {
198
- default: withCtx(() => [
199
- createTextVNode(toDisplayString(__props.cancelText), 1)
200
- ]),
201
- _: 1
202
- }, 8, ["disabled"]),
203
- createVNode(unref(ElButton), {
204
- type: "primary",
205
- disabled: __props.submitDisabled || __props.disabled,
206
- loading: false,
207
- onClick: handleSubmit
208
- }, {
209
- default: withCtx(() => [
210
- createTextVNode(toDisplayString(__props.submitText), 1)
211
- ]),
212
- _: 1
213
- }, 8, ["disabled"])
214
- ])) : createCommentVNode("", true)
318
+ }, 16, ["model", "class", "style"])
215
319
  ], 2);
216
320
  };
217
321
  }
@@ -51,10 +51,12 @@ var __async = (__this, __arguments, generator) => {
51
51
  };
52
52
  import { defineComponent, ref, watch, computed, openBlock, createElementBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, resolveDynamicComponent, Fragment, createTextVNode, toDisplayString, createCommentVNode, createSlots, h } from "vue";
53
53
  import { Plus as plus_default, CircleCloseFilled as circle_close_filled_default, CircleCheckFilled as circle_check_filled_default, WarningFilled as warning_filled_default, QuestionFilled as question_filled_default } from "../node_modules/@element-plus/icons-vue/dist/index.js";
54
- import { ElFormItem, ElDivider, ElInput, ElUpload, ElButton, ElIcon, ElInputNumber, ElRate, ElColorPicker, ElTreeSelect, ElCascader, ElSlider, ElSwitch, ElCheckboxGroup, ElCheckbox, ElRadioGroup, ElRadio, ElTimeSelect, ElTimePicker, ElDatePicker, ElAutocomplete, ElSelect, ElTooltip } from "element-plus";
54
+ import { ElFormItem, ElDivider, ElInput, ElUpload, ElButton, ElIcon, ElInputNumber, ElRate, ElTransfer, ElSelectV2, ElMention, ElInputTag, ElColorPickerPanel, ElColorPicker, ElTreeSelect, ElCascader, ElSlider, ElSwitch, ElCheckboxGroup, ElCheckbox, ElRadioGroup, 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";
59
+ /* empty css */
58
60
  const _hoisted_1 = {
59
61
  key: 0,
60
62
  style: { "display": "none" }
@@ -161,7 +163,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
161
163
  placeholder,
162
164
  componentProps: componentProps2,
163
165
  hidden,
164
- className,
165
166
  customStyle,
166
167
  children,
167
168
  render,
@@ -184,7 +185,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
184
185
  "placeholder",
185
186
  "componentProps",
186
187
  "hidden",
187
- "className",
188
188
  "customStyle",
189
189
  "children",
190
190
  "render",
@@ -211,32 +211,41 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
211
211
  default: () => props.config.children || null
212
212
  });
213
213
  }
214
- const commonProps = __spreadValues({
215
- "modelValue": modelValue.value,
214
+ const commonProps = __spreadProps(__spreadValues({
215
+ // use `undefined` to fix placeholder issue
216
+ "modelValue": modelValue.value || void 0,
216
217
  "onUpdate:modelValue": (val) => {
217
- props.model[props.field] = val;
218
+ props.model[props.field] = val || void 0;
218
219
  },
219
- "placeholder": props.config.placeholder,
220
+ "placeholder": props.config.placeholder || void 0,
220
221
  "disabled": props.disabled,
221
222
  "clearable": props.config.clearable
222
- }, componentProps.value);
223
+ }, componentProps.value), {
224
+ "class": ["w-full min-w-25", componentProps.value.class]
225
+ });
223
226
  switch (type) {
224
227
  case "input":
225
228
  return h(ElInput, __spreadProps(__spreadValues({}, commonProps), {
229
+ placeholder: commonProps.placeholder || "请输入",
226
230
  prefixIcon: props.config.prefixIcon,
227
231
  suffixIcon: props.config.suffixIcon
228
232
  }));
229
233
  case "textarea":
230
234
  return h(ElInput, __spreadProps(__spreadValues({}, commonProps), {
235
+ placeholder: commonProps.placeholder || "请输入",
231
236
  type: "textarea",
232
237
  rows: 4
233
238
  }));
234
239
  case "select": {
235
- const selectProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
240
+ const selectProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
241
+ placeholder: commonProps.placeholder || "请选择"
242
+ }), componentProps.value);
236
243
  return h(ElSelect, selectProps);
237
244
  }
238
245
  case "autocomplete": {
239
- const autocompleteProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
246
+ const autocompleteProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
247
+ placeholder: commonProps.placeholder || "请输入"
248
+ }), componentProps.value);
240
249
  return h(ElAutocomplete, autocompleteProps);
241
250
  }
242
251
  case "datepicker":
@@ -297,20 +306,73 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
297
306
  case "slider":
298
307
  return h(ElSlider, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
299
308
  case "cascader": {
300
- const cascaderProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
309
+ const cascaderProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
310
+ placeholder: commonProps.placeholder || "请选择"
311
+ }), componentProps.value);
301
312
  return h(ElCascader, cascaderProps);
302
313
  }
303
314
  case "tree-select": {
304
- const treeSelectProps = __spreadValues(__spreadValues({}, commonProps), componentProps.value);
315
+ const treeSelectProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
316
+ placeholder: commonProps.placeholder || "请选择"
317
+ }), componentProps.value);
305
318
  return h(ElTreeSelect, treeSelectProps);
306
319
  }
307
320
  case "color-picker":
308
321
  return h(ElColorPicker, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
322
+ // 颜色选择器面板
323
+ case "color-picker-panel":
324
+ return h(ElColorPickerPanel, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
325
+ // 标签输入框
326
+ case "input-tag": {
327
+ const inputTagProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
328
+ "modelValue": modelValue.value || [],
329
+ "onUpdate:modelValue": (val) => {
330
+ props.model[props.field] = val;
331
+ }
332
+ }), componentProps.value);
333
+ return h(ElInputTag, inputTagProps);
334
+ }
335
+ // 提及组件
336
+ case "mention": {
337
+ const mentionProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
338
+ "modelValue": modelValue.value || "",
339
+ "onUpdate:modelValue": (val) => {
340
+ props.model[props.field] = val;
341
+ }
342
+ }), componentProps.value);
343
+ return h(ElMention, mentionProps);
344
+ }
345
+ // 虚拟化选择器
346
+ case "select-v2": {
347
+ const selectV2Props = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
348
+ "modelValue": modelValue.value,
349
+ "onUpdate:modelValue": (val) => {
350
+ props.model[props.field] = val;
351
+ },
352
+ "options": componentProps.value.options || []
353
+ }), componentProps.value);
354
+ return h(ElSelectV2, selectV2Props);
355
+ }
356
+ // 穿梭框
357
+ case "transfer": {
358
+ const transferProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
359
+ "modelValue": modelValue.value || [],
360
+ "onUpdate:modelValue": (val) => {
361
+ props.model[props.field] = val;
362
+ },
363
+ "data": componentProps.value.data || []
364
+ }), componentProps.value);
365
+ return h(ElTransfer, transferProps);
366
+ }
367
+ // 表格选择器
368
+ case "select-table":
369
+ return h(_sfc_main$1, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
309
370
  case "rate":
310
371
  return h(ElRate, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
311
372
  case "input-number": {
312
373
  const numberModelValue = modelValue.value === "" || modelValue.value === null || modelValue.value === void 0 ? null : Number(modelValue.value);
313
374
  const inputNumberProps = __spreadValues(__spreadProps(__spreadValues({}, commonProps), {
375
+ "placeholder": commonProps.placeholder || "请输入",
314
376
  "modelValue": numberModelValue,
315
377
  "onUpdate:modelValue": (val) => {
316
378
  props.model[props.field] = val;
@@ -431,7 +493,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
431
493
  key: 1,
432
494
  prop: __props.field
433
495
  }, __spreadValues(__spreadValues({}, formItemProps.value), _ctx.$attrs), {
434
- class: ["jky-form-item jky-form-item--no-label", [__props.config.useDefaultBorderClass ? "border-l-4 border-solid border-l-(--el-color-primary) bg-(--el-color-primary)/50 pl-1.5" : "", __props.config.className]],
496
+ class: ["jky-form-item jky-form-item--no-label", [__props.config.useDefaultBorderClass ? "border-l-4 border-solid border-l-(--el-color-primary) bg-(--el-color-primary)/50 pl-1.5" : "", __props.config.class]],
435
497
  style: [__props.config.customStyle]
436
498
  }), {
437
499
  default: withCtx(() => [
@@ -450,7 +512,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
450
512
  label: __props.config.label,
451
513
  prop: __props.field
452
514
  }, __spreadValues(__spreadValues({}, formItemProps.value), _ctx.$attrs), {
453
- class: ["jky-form-item", [__props.config.className]]
515
+ class: ["jky-form-item", [__props.config.class]]
454
516
  }), createSlots({
455
517
  default: withCtx(() => [
456
518
  __props.config.prepend || __props.config.append ? (openBlock(), createElementBlock("div", _hoisted_4, [
@@ -0,0 +1,38 @@
1
+ import { SelectTableProps } from './types';
2
+ declare const _default: import('vue').DefineComponent<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<SelectTableProps>, {
3
+ multiple: boolean;
4
+ labelField: string;
5
+ idField: string;
6
+ readonly: boolean;
7
+ disabled: boolean;
8
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
+ "update:modelValue": (value: string | number | (string | number)[]) => any;
10
+ change: (value: string | number | (string | number)[], selectedData: any[]) => any;
11
+ }, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<SelectTableProps>, {
12
+ multiple: boolean;
13
+ labelField: string;
14
+ idField: string;
15
+ readonly: boolean;
16
+ disabled: boolean;
17
+ }>>> & Readonly<{
18
+ "onUpdate:modelValue"?: ((value: string | number | (string | number)[]) => any) | undefined;
19
+ onChange?: ((value: string | number | (string | number)[], selectedData: any[]) => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
22
+ type __VLS_WithDefaults<P, D> = {
23
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
24
+ default: D[K];
25
+ }> : P[K];
26
+ };
27
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
+ type __VLS_TypePropsToOption<T> = {
29
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
30
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
+ } : {
32
+ type: import('vue').PropType<T[K]>;
33
+ required: true;
34
+ };
35
+ };
36
+ type __VLS_PrettifyLocal<T> = {
37
+ [K in keyof T]: T[K];
38
+ } & {};