gi-component 0.0.2 → 0.0.4
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.
- package/dist/gi.css +1 -1
- package/dist/index.d.ts +749 -0
- package/dist/index.es.js +109 -99
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/packages/components/dialog/src/dialog.ts +1 -1
- package/packages/components/edit-table/src/edit-table.vue +193 -207
- package/packages/components/edit-table/src/type.ts +71 -69
- package/packages/components/table/src/TableColumn.vue +49 -49
- package/packages/components/table/src/table.vue +89 -85
- package/packages/components/table/src/type.ts +22 -22
- package/packages/hooks/useTable.ts +3 -0
- package/packages/utils/createSelectDialog.ts +5 -6
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, createElementBlock, openBlock, createElementVNode, getCurrentInstance, useAttrs, computed, resolveComponent, createBlock, mergeProps, unref, withCtx, renderSlot, createTextVNode, toDisplayString, useSlots, normalizeClass, createCommentVNode, normalizeStyle, mergeModels, useModel, ref, createSlots, resolveDynamicComponent, createVNode, createApp, h, Fragment, renderList, watch, onMounted, onUpdated, onUnmounted, inject, toRefs, watchEffect, reactive, provide, toRaw, normalizeProps, guardReactiveProps } from "vue";
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, createElementVNode, getCurrentInstance, useAttrs, computed, resolveComponent, createBlock, mergeProps, unref, withCtx, renderSlot, createTextVNode, toDisplayString, useSlots, normalizeClass, createCommentVNode, normalizeStyle, mergeModels, useModel, ref, createSlots, resolveDynamicComponent, createVNode, createApp, h, Fragment, renderList, watch, onMounted, onUpdated, onUnmounted, inject, toRefs, watchEffect, reactive, provide, toRaw, normalizeProps, guardReactiveProps, useTemplateRef } from "vue";
|
|
2
2
|
import * as El from "element-plus";
|
|
3
3
|
import El__default, { ElMessage } from "element-plus";
|
|
4
4
|
/*! Element Plus Icons Vue v2.3.2 */
|
|
@@ -559,8 +559,79 @@ function createDialog() {
|
|
|
559
559
|
return Dialog2;
|
|
560
560
|
}
|
|
561
561
|
const Dialog = createDialog();
|
|
562
|
-
const clearable = false;
|
|
563
562
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
563
|
+
__name: "input-group",
|
|
564
|
+
setup(__props) {
|
|
565
|
+
const { b } = useBemClass();
|
|
566
|
+
return (_ctx, _cache) => {
|
|
567
|
+
return openBlock(), createElementBlock("div", {
|
|
568
|
+
class: normalizeClass(unref(b)("input-group"))
|
|
569
|
+
}, [
|
|
570
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
571
|
+
], 2);
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
const InputGroup = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-cd21cbfd"]]);
|
|
576
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
577
|
+
__name: "input-search",
|
|
578
|
+
props: /* @__PURE__ */ mergeModels({
|
|
579
|
+
disabled: { type: Boolean, default: false },
|
|
580
|
+
readonly: { type: Boolean, default: false },
|
|
581
|
+
placeholder: { default: "请选择" },
|
|
582
|
+
disabledHideButton: { type: Boolean, default: false }
|
|
583
|
+
}, {
|
|
584
|
+
"modelValue": { type: String },
|
|
585
|
+
"modelModifiers": {}
|
|
586
|
+
}),
|
|
587
|
+
emits: /* @__PURE__ */ mergeModels(["search", "clear"], ["update:modelValue"]),
|
|
588
|
+
setup(__props, { emit: __emit }) {
|
|
589
|
+
const model = useModel(__props, "modelValue");
|
|
590
|
+
const props = __props;
|
|
591
|
+
const emit = __emit;
|
|
592
|
+
const { b } = useBemClass();
|
|
593
|
+
const showButton = computed(() => {
|
|
594
|
+
if (props.readonly) return false;
|
|
595
|
+
if (props.disabled) {
|
|
596
|
+
return !props.disabledHideButton;
|
|
597
|
+
}
|
|
598
|
+
return true;
|
|
599
|
+
});
|
|
600
|
+
return (_ctx, _cache) => {
|
|
601
|
+
const _component_el_input = resolveComponent("el-input");
|
|
602
|
+
const _component_el_button = resolveComponent("el-button");
|
|
603
|
+
return openBlock(), createBlock(InputGroup, {
|
|
604
|
+
class: normalizeClass(unref(b)("input-search"))
|
|
605
|
+
}, {
|
|
606
|
+
default: withCtx(() => [
|
|
607
|
+
createVNode(_component_el_input, {
|
|
608
|
+
modelValue: model.value,
|
|
609
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
610
|
+
disabled: props.disabled,
|
|
611
|
+
readonly: !props.disabled,
|
|
612
|
+
placeholder: props.placeholder
|
|
613
|
+
}, null, 8, ["modelValue", "disabled", "readonly", "placeholder"]),
|
|
614
|
+
showButton.value ? (openBlock(), createBlock(_component_el_button, {
|
|
615
|
+
key: 0,
|
|
616
|
+
icon: unref(search_default),
|
|
617
|
+
disabled: props.disabled,
|
|
618
|
+
onClick: _cache[1] || (_cache[1] = ($event) => emit("search"))
|
|
619
|
+
}, null, 8, ["icon", "disabled"])) : createCommentVNode("", true),
|
|
620
|
+
showButton.value ? (openBlock(), createBlock(_component_el_button, {
|
|
621
|
+
key: 1,
|
|
622
|
+
icon: unref(close_default),
|
|
623
|
+
disabled: props.disabled,
|
|
624
|
+
onClick: _cache[2] || (_cache[2] = ($event) => emit("clear"))
|
|
625
|
+
}, null, 8, ["icon", "disabled"])) : createCommentVNode("", true)
|
|
626
|
+
]),
|
|
627
|
+
_: 1
|
|
628
|
+
}, 8, ["class"]);
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
const InputSearch = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-788824ed"]]);
|
|
633
|
+
const clearable = false;
|
|
634
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
564
635
|
__name: "edit-table",
|
|
565
636
|
props: {
|
|
566
637
|
rowKey: { default: "id" },
|
|
@@ -594,7 +665,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
594
665
|
"color-picker": El.ElColorPicker,
|
|
595
666
|
transfer: El.ElTransfer,
|
|
596
667
|
autocomplete: El.ElAutocomplete,
|
|
597
|
-
upload: El.ElUpload
|
|
668
|
+
upload: El.ElUpload,
|
|
669
|
+
"input-search": InputSearch
|
|
598
670
|
};
|
|
599
671
|
const formRef = ref();
|
|
600
672
|
const form = computed(() => ({ tableData: props.data }));
|
|
@@ -635,15 +707,15 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
635
707
|
const getPlaceholder = (item) => {
|
|
636
708
|
if (!item.type) return void 0;
|
|
637
709
|
if (["input", "input-number", "input-tag"].includes(item.type)) {
|
|
638
|
-
return `请输入${item.
|
|
710
|
+
return `请输入${item.label}`;
|
|
639
711
|
}
|
|
640
712
|
if (["textarea"].includes(item.type)) {
|
|
641
|
-
return `请填写${item.
|
|
713
|
+
return `请填写${item.label}`;
|
|
642
714
|
}
|
|
643
|
-
if (["select", "select-v2", "tree-select", "cascader", "time-select"].includes(
|
|
715
|
+
if (["select", "select-v2", "tree-select", "cascader", "time-select", "input-search"].includes(
|
|
644
716
|
item.type
|
|
645
717
|
)) {
|
|
646
|
-
return `请选择${item.
|
|
718
|
+
return `请选择${item.label}`;
|
|
647
719
|
}
|
|
648
720
|
if (["date-picker"].includes(item.type)) {
|
|
649
721
|
return `请选择日期`;
|
|
@@ -658,14 +730,14 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
658
730
|
const defaultProps = STATIC_PROPS.get(item.type || "") || {};
|
|
659
731
|
defaultProps.placeholder = getPlaceholder(item);
|
|
660
732
|
if (item.type === "date-picker") {
|
|
661
|
-
defaultProps.valueFormat = ((_a = item == null ? void 0 : item.
|
|
733
|
+
defaultProps.valueFormat = ((_a = item == null ? void 0 : item.componentProps) == null ? void 0 : _a.type) === "datetime" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD";
|
|
662
734
|
}
|
|
663
|
-
return { ...defaultProps, ...item.
|
|
735
|
+
return { ...defaultProps, ...item.componentProps };
|
|
664
736
|
}
|
|
665
737
|
function getFormItemRules(item) {
|
|
666
738
|
if (item.required) {
|
|
667
739
|
return [
|
|
668
|
-
{ required: true, message: `${item.
|
|
740
|
+
{ required: true, message: `${item.label}为必填项` },
|
|
669
741
|
...Array.isArray(item.rules) ? item.rules : []
|
|
670
742
|
];
|
|
671
743
|
}
|
|
@@ -699,17 +771,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
699
771
|
default: withCtx(() => [
|
|
700
772
|
(openBlock(true), createElementBlock(Fragment, null, renderList(props.columns, (column, index2) => {
|
|
701
773
|
return openBlock(), createBlock(_component_el_table_column, mergeProps({
|
|
702
|
-
key: column.
|
|
774
|
+
key: column.prop + index2,
|
|
703
775
|
width: column.width
|
|
704
776
|
}, { ref_for: true }, column.columnProps, {
|
|
705
|
-
prop: column.
|
|
706
|
-
label: column.
|
|
777
|
+
prop: column.prop,
|
|
778
|
+
label: column.label,
|
|
707
779
|
"label-class-name": getLabelClassName(column)
|
|
708
780
|
}), {
|
|
709
781
|
default: withCtx((scope) => [
|
|
710
782
|
createVNode(_component_el_form_item, mergeProps({ ref_for: true }, column.formItemProps, {
|
|
711
|
-
label: column.
|
|
712
|
-
prop: `tableData[${scope.$index}].${column.
|
|
783
|
+
label: column.label,
|
|
784
|
+
prop: `tableData[${scope.$index}].${column.prop}`,
|
|
713
785
|
rules: getFormItemRules(column)
|
|
714
786
|
}), {
|
|
715
787
|
default: withCtx(() => [
|
|
@@ -720,8 +792,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
720
792
|
key: 1,
|
|
721
793
|
ref_for: true
|
|
722
794
|
}, getComponentBindProps(column), {
|
|
723
|
-
modelValue: scope.row[column.
|
|
724
|
-
"onUpdate:modelValue": ($event) => scope.row[column.
|
|
795
|
+
modelValue: scope.row[column.prop],
|
|
796
|
+
"onUpdate:modelValue": ($event) => scope.row[column.prop] = $event,
|
|
725
797
|
class: "w-full",
|
|
726
798
|
disabled: isDisabled(scope)
|
|
727
799
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
|
|
@@ -741,7 +813,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
741
813
|
};
|
|
742
814
|
}
|
|
743
815
|
});
|
|
744
|
-
const EditTable = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
816
|
+
const EditTable = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-411a7fe4"]]);
|
|
745
817
|
const GridContextInjectionKey = Symbol(
|
|
746
818
|
"GridContextInjectionKey"
|
|
747
819
|
);
|
|
@@ -996,7 +1068,7 @@ function getPrefixCls(name) {
|
|
|
996
1068
|
const { b } = useBemClass();
|
|
997
1069
|
return b(name);
|
|
998
1070
|
}
|
|
999
|
-
const _sfc_main$
|
|
1071
|
+
const _sfc_main$7 = defineComponent({
|
|
1000
1072
|
name: "GridItem",
|
|
1001
1073
|
props: {
|
|
1002
1074
|
/**
|
|
@@ -1114,8 +1186,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1114
1186
|
renderSlot(_ctx.$slots, "default", { overflow: _ctx.overflow })
|
|
1115
1187
|
], 6);
|
|
1116
1188
|
}
|
|
1117
|
-
const GridItem = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1118
|
-
const _sfc_main$
|
|
1189
|
+
const GridItem = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$1]]);
|
|
1190
|
+
const _sfc_main$6 = defineComponent({
|
|
1119
1191
|
name: "Grid",
|
|
1120
1192
|
props: {
|
|
1121
1193
|
/**
|
|
@@ -1229,78 +1301,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1229
1301
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1230
1302
|
], 6);
|
|
1231
1303
|
}
|
|
1232
|
-
const Grid = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1233
|
-
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1234
|
-
__name: "input-group",
|
|
1235
|
-
setup(__props) {
|
|
1236
|
-
const { b } = useBemClass();
|
|
1237
|
-
return (_ctx, _cache) => {
|
|
1238
|
-
return openBlock(), createElementBlock("div", {
|
|
1239
|
-
class: normalizeClass(unref(b)("input-group"))
|
|
1240
|
-
}, [
|
|
1241
|
-
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
1242
|
-
], 2);
|
|
1243
|
-
};
|
|
1244
|
-
}
|
|
1245
|
-
});
|
|
1246
|
-
const InputGroup = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-cd21cbfd"]]);
|
|
1247
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1248
|
-
__name: "input-search",
|
|
1249
|
-
props: /* @__PURE__ */ mergeModels({
|
|
1250
|
-
disabled: { type: Boolean, default: false },
|
|
1251
|
-
readonly: { type: Boolean, default: false },
|
|
1252
|
-
placeholder: { default: "请选择" },
|
|
1253
|
-
disabledHideButton: { type: Boolean, default: false }
|
|
1254
|
-
}, {
|
|
1255
|
-
"modelValue": { type: String },
|
|
1256
|
-
"modelModifiers": {}
|
|
1257
|
-
}),
|
|
1258
|
-
emits: /* @__PURE__ */ mergeModels(["search", "clear"], ["update:modelValue"]),
|
|
1259
|
-
setup(__props, { emit: __emit }) {
|
|
1260
|
-
const model = useModel(__props, "modelValue");
|
|
1261
|
-
const props = __props;
|
|
1262
|
-
const emit = __emit;
|
|
1263
|
-
const { b } = useBemClass();
|
|
1264
|
-
const showButton = computed(() => {
|
|
1265
|
-
if (props.readonly) return false;
|
|
1266
|
-
if (props.disabled) {
|
|
1267
|
-
return !props.disabledHideButton;
|
|
1268
|
-
}
|
|
1269
|
-
return true;
|
|
1270
|
-
});
|
|
1271
|
-
return (_ctx, _cache) => {
|
|
1272
|
-
const _component_el_input = resolveComponent("el-input");
|
|
1273
|
-
const _component_el_button = resolveComponent("el-button");
|
|
1274
|
-
return openBlock(), createBlock(InputGroup, {
|
|
1275
|
-
class: normalizeClass(unref(b)("input-search"))
|
|
1276
|
-
}, {
|
|
1277
|
-
default: withCtx(() => [
|
|
1278
|
-
createVNode(_component_el_input, {
|
|
1279
|
-
modelValue: model.value,
|
|
1280
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
1281
|
-
disabled: props.disabled,
|
|
1282
|
-
readonly: !props.disabled,
|
|
1283
|
-
placeholder: props.placeholder
|
|
1284
|
-
}, null, 8, ["modelValue", "disabled", "readonly", "placeholder"]),
|
|
1285
|
-
showButton.value ? (openBlock(), createBlock(_component_el_button, {
|
|
1286
|
-
key: 0,
|
|
1287
|
-
icon: unref(search_default),
|
|
1288
|
-
disabled: props.disabled,
|
|
1289
|
-
onClick: _cache[1] || (_cache[1] = ($event) => emit("search"))
|
|
1290
|
-
}, null, 8, ["icon", "disabled"])) : createCommentVNode("", true),
|
|
1291
|
-
showButton.value ? (openBlock(), createBlock(_component_el_button, {
|
|
1292
|
-
key: 1,
|
|
1293
|
-
icon: unref(close_default),
|
|
1294
|
-
disabled: props.disabled,
|
|
1295
|
-
onClick: _cache[2] || (_cache[2] = ($event) => emit("clear"))
|
|
1296
|
-
}, null, 8, ["icon", "disabled"])) : createCommentVNode("", true)
|
|
1297
|
-
]),
|
|
1298
|
-
_: 1
|
|
1299
|
-
}, 8, ["class"]);
|
|
1300
|
-
};
|
|
1301
|
-
}
|
|
1302
|
-
});
|
|
1303
|
-
const InputSearch = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-788824ed"]]);
|
|
1304
|
+
const Grid = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render], ["__scopeId", "data-v-4f2b02b0"]]);
|
|
1304
1305
|
const _hoisted_1 = {
|
|
1305
1306
|
key: 0,
|
|
1306
1307
|
class: "w-full"
|
|
@@ -1993,10 +1994,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1993
1994
|
scrollbarTabindex: {},
|
|
1994
1995
|
nativeScrollbar: {}
|
|
1995
1996
|
},
|
|
1996
|
-
setup(__props) {
|
|
1997
|
+
setup(__props, { expose: __expose }) {
|
|
1997
1998
|
const props = __props;
|
|
1998
1999
|
const attrs = useAttrs();
|
|
1999
2000
|
const { b } = useBemClass();
|
|
2001
|
+
const tableRef = useTemplateRef("tableRef");
|
|
2000
2002
|
const tableProps = computed(() => {
|
|
2001
2003
|
return {
|
|
2002
2004
|
...attrs,
|
|
@@ -2019,12 +2021,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2019
2021
|
function handleCurrentChange(page) {
|
|
2020
2022
|
props.pagination.currentPage = page;
|
|
2021
2023
|
}
|
|
2024
|
+
__expose({
|
|
2025
|
+
tableRef
|
|
2026
|
+
});
|
|
2022
2027
|
return (_ctx, _cache) => {
|
|
2023
2028
|
const _component_el_table = resolveComponent("el-table");
|
|
2024
2029
|
const _component_el_pagination = resolveComponent("el-pagination");
|
|
2025
2030
|
const _component_el_row = resolveComponent("el-row");
|
|
2026
|
-
return openBlock(), createElementBlock("div",
|
|
2031
|
+
return openBlock(), createElementBlock("div", {
|
|
2032
|
+
class: normalizeClass(unref(b)("table"))
|
|
2033
|
+
}, [
|
|
2027
2034
|
createVNode(_component_el_table, mergeProps(tableProps.value, {
|
|
2035
|
+
ref_key: "tableRef",
|
|
2036
|
+
ref: tableRef,
|
|
2028
2037
|
data: props.data
|
|
2029
2038
|
}), {
|
|
2030
2039
|
default: withCtx(() => [
|
|
@@ -2062,11 +2071,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2062
2071
|
]),
|
|
2063
2072
|
_: 1
|
|
2064
2073
|
}, 8, ["class"])
|
|
2065
|
-
]);
|
|
2074
|
+
], 2);
|
|
2066
2075
|
};
|
|
2067
2076
|
}
|
|
2068
2077
|
});
|
|
2069
|
-
const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
2078
|
+
const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-002f7dd8"]]);
|
|
2070
2079
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2071
2080
|
__name: "tabs",
|
|
2072
2081
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -2148,6 +2157,8 @@ const createSelectDialog = (params) => {
|
|
|
2148
2157
|
const { multiple = false, onOk, onBeforeOk, queryParams } = options;
|
|
2149
2158
|
const DialogTableRef = ref();
|
|
2150
2159
|
Dialog.open({
|
|
2160
|
+
bodyClass: "gi-p0",
|
|
2161
|
+
...{ ...params, component: void 0, componentProps: void 0, tip: void 0 },
|
|
2151
2162
|
title: params.title || options.title,
|
|
2152
2163
|
content: () => h(params.component, {
|
|
2153
2164
|
ref: (e) => DialogTableRef.value = e,
|
|
@@ -2155,8 +2166,7 @@ const createSelectDialog = (params) => {
|
|
|
2155
2166
|
queryParams,
|
|
2156
2167
|
...params.componentProps
|
|
2157
2168
|
}),
|
|
2158
|
-
style: { maxWidth: "
|
|
2159
|
-
bodyClass: params.bodyClass,
|
|
2169
|
+
style: { maxWidth: "1000px", ...params.style },
|
|
2160
2170
|
onBeforeOk: async () => {
|
|
2161
2171
|
var _a;
|
|
2162
2172
|
if (!DialogTableRef.value.getSelectedData) {
|