mrxy-yk 1.2.9 → 1.2.11

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,5 +1,6 @@
1
1
  import { ElUploadGlobal, ElUploadImagesGlobal } from "../element-plus/components/upload/index.js";
2
2
  import { ElImagesGlobal } from "../element-plus/components/images/index.js";
3
+ import { ElTableColumnGlobal } from "../element-plus/components/table-column/index.js";
3
4
  import { ExportLinkGlobal } from "../components/export-link/index.js";
4
5
  import { EmptyGlobal } from "../components/empty/index.js";
5
6
  const AMapConfig = {
@@ -16,6 +17,7 @@ export {
16
17
  AMapConfig,
17
18
  EChartsThemeConfig,
18
19
  ElImagesGlobal,
20
+ ElTableColumnGlobal,
19
21
  ElUploadGlobal,
20
22
  ElUploadImagesGlobal,
21
23
  EmptyGlobal,
@@ -1,2 +1,3 @@
1
1
  export { ElUploadGlobal, ElUploadImagesGlobal } from './upload/index';
2
2
  export { ElImagesGlobal } from './images/index';
3
+ export { ElTableColumnGlobal } from './table-column/index';
@@ -1,23 +1,20 @@
1
1
  import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
2
  type __VLS_Props = {
3
- prop?: string;
4
- type?: 'index' | 'selection' | 'expand';
5
3
  emptyStr?: string;
6
4
  };
7
5
  declare function __VLS_template(): {
8
6
  attrs: Partial<{}>;
9
7
  slots: {
10
- default?(_: {
11
- row: any;
12
- }): any;
8
+ 'filter-icon'?(_: {}): any;
9
+ expand?(_: {}): any;
10
+ header?(_: {}): any;
11
+ default?(_: {}): any;
13
12
  };
14
13
  refs: {};
15
14
  rootEl: any;
16
15
  };
17
16
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
18
- declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
19
- emptyStr: string;
20
- }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
17
+ declare const __VLS_component: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
21
18
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
22
19
  export default _default;
23
20
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,31 +1,50 @@
1
1
  import { ElTableColumn } from "element-plus/es";
2
- import { defineComponent, openBlock, createBlock, mergeProps, withCtx, renderSlot, createTextVNode, toDisplayString, unref, createCommentVNode } from "vue";
2
+ import { defineComponent, openBlock, createBlock, mergeProps, createSlots, withCtx, renderSlot } from "vue";
3
3
  import { ObjectUtil } from "../../../utils/prototype/lib/ObjectUtil.js";
4
+ import { ElTableColumnGlobal } from "./index.js";
4
5
  var _sfc_main = /* @__PURE__ */ defineComponent({
5
6
  __name: "TableColumn",
6
7
  props: {
7
- prop: {},
8
- type: {},
9
- emptyStr: { default: "—" }
8
+ emptyStr: {}
10
9
  },
11
10
  setup(__props) {
12
11
  const props = __props;
12
+ const emptyStr = props.emptyStr || ElTableColumnGlobal.props.emptyStr.default || "—";
13
+ function defaultFormatter(row, column, cellValue, index) {
14
+ return ObjectUtil.isEmptyToVal(cellValue, emptyStr);
15
+ }
13
16
  return (_ctx, _cache) => {
14
17
  const _component_el_table_column = ElTableColumn;
15
- return openBlock(), createBlock(_component_el_table_column, mergeProps({
16
- type: props.type,
17
- prop: props.prop
18
- }, _ctx.$attrs), {
19
- default: withCtx(({ row }) => [
20
- !props.type ? renderSlot(_ctx.$slots, "default", {
21
- key: 0,
22
- row
23
- }, () => [
24
- createTextVNode(toDisplayString(props.prop ? unref(ObjectUtil).isEmptyToVal(unref(ObjectUtil).getAttr(row, props.prop, "."), props.emptyStr) : ""), 1)
25
- ]) : createCommentVNode("", true)
26
- ]),
27
- _: 3
28
- }, 16, ["type", "prop"]);
18
+ return openBlock(), createBlock(_component_el_table_column, mergeProps(_ctx.$attrs, { formatter: defaultFormatter }), createSlots({ _: 2 }, [
19
+ _ctx.$slots["filter-icon"] ? {
20
+ name: "filter-icon",
21
+ fn: withCtx(() => [
22
+ renderSlot(_ctx.$slots, "filter-icon")
23
+ ]),
24
+ key: "0"
25
+ } : void 0,
26
+ _ctx.$slots["expand"] ? {
27
+ name: "expand",
28
+ fn: withCtx(() => [
29
+ renderSlot(_ctx.$slots, "expand")
30
+ ]),
31
+ key: "1"
32
+ } : void 0,
33
+ _ctx.$slots["header"] ? {
34
+ name: "header",
35
+ fn: withCtx(() => [
36
+ renderSlot(_ctx.$slots, "header")
37
+ ]),
38
+ key: "2"
39
+ } : void 0,
40
+ _ctx.$slots["default"] ? {
41
+ name: "default",
42
+ fn: withCtx(() => [
43
+ renderSlot(_ctx.$slots, "default")
44
+ ]),
45
+ key: "3"
46
+ } : void 0
47
+ ]), 1040);
29
48
  };
30
49
  }
31
50
  });
@@ -0,0 +1,7 @@
1
+ export declare const ElTableColumnGlobal: {
2
+ props: {
3
+ emptyStr: {
4
+ default: string;
5
+ };
6
+ };
7
+ };
@@ -0,0 +1,10 @@
1
+ const ElTableColumnGlobal = {
2
+ props: {
3
+ emptyStr: {
4
+ default: null
5
+ }
6
+ }
7
+ };
8
+ export {
9
+ ElTableColumnGlobal
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mrxy-yk",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A collection of Vue 3 components and utilities",
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "mrxy-yk",
4
- "version": "1.2.9",
4
+ "version": "1.2.11",
5
5
  "js-types-syntax": "typescript",
6
6
  "contributions": {
7
7
  "html": {
@@ -1465,7 +1465,27 @@
1465
1465
  "slots": [
1466
1466
  {
1467
1467
  "name": "default",
1468
- "type": "{ column: TableColumnCtx<T>, $index: number, row: any }"
1468
+ "description": "Custom content for table columns",
1469
+ "doc-url": "https://element-plus.org/en-US/component/table.html#table-column-slots",
1470
+ "type": "{ row: any, column: TableColumnCtx<T>, $index: number }"
1471
+ },
1472
+ {
1473
+ "name": "header",
1474
+ "description": "Custom content for table header",
1475
+ "doc-url": "https://element-plus.org/en-US/component/table.html#table-column-slots",
1476
+ "type": "{ column: TableColumnCtx<T>, $index: number }"
1477
+ },
1478
+ {
1479
+ "name": "filter-icon",
1480
+ "description": "Custom content for filter icon",
1481
+ "doc-url": "https://element-plus.org/en-US/component/table.html#table-column-slots",
1482
+ "type": "{ filterOpened: boolean }"
1483
+ },
1484
+ {
1485
+ "name": "expand",
1486
+ "description": "Custom content for expand columns. The `expandable` property is supported starting from v2.13.2.",
1487
+ "doc-url": "https://element-plus.org/en-US/component/table.html#table-column-slots",
1488
+ "type": "{ expanded: boolean, expandable: boolean }"
1469
1489
  }
1470
1490
  ]
1471
1491
  }