3h1-ui 2.15.15 → 2.15.17

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 (3) hide show
  1. package/es/index.js +69 -15
  2. package/lib/index.js +69 -15
  3. package/package.json +1 -1
package/es/index.js CHANGED
@@ -23258,6 +23258,10 @@ const basicProps = {
23258
23258
  },
23259
23259
  sortConfig: {
23260
23260
  showIcon: false
23261
+ },
23262
+ pagination: {
23263
+ type: [Object, Boolean],
23264
+ default: true
23261
23265
  }
23262
23266
  };
23263
23267
  const basicColumn = {
@@ -23267,13 +23271,24 @@ const basicColumn = {
23267
23271
  visible: true,
23268
23272
  sortable: false
23269
23273
  };
23270
- const usePagination = () => {
23271
- const page = reactive({
23272
- total: 0,
23273
- current: 1,
23274
- pageSize: 10,
23275
- pageSizeOptions: ["10", "20", "30", "40"]
23276
- });
23274
+ const usePagination = (getProps) => {
23275
+ watch(
23276
+ () => getProps.value.pagination,
23277
+ (pagination) => {
23278
+ if (!isBoolean(pagination) && pagination) {
23279
+ setPage(pagination);
23280
+ }
23281
+ }
23282
+ );
23283
+ const page = reactive(
23284
+ {
23285
+ total: 0,
23286
+ current: 1,
23287
+ pageSize: 10,
23288
+ pageSizeOptions: ["10", "20", "30", "40"],
23289
+ ...getProps.value.pagination
23290
+ }
23291
+ );
23277
23292
  const setPage = (pageInfo) => {
23278
23293
  return new Promise((resolve) => {
23279
23294
  nextTick(() => {
@@ -23290,7 +23305,11 @@ const useTableData = (getProps, { setPage, params, tableRef }) => {
23290
23305
  const dataSource = ref([]);
23291
23306
  const setTableData = (data) => {
23292
23307
  dataSource.value = data.map((item) => {
23293
- item._isEdit = false;
23308
+ if (getProps.value.isUseEdit) {
23309
+ item._isEdit = true;
23310
+ } else {
23311
+ item._isEdit = false;
23312
+ }
23294
23313
  return item;
23295
23314
  });
23296
23315
  };
@@ -23300,6 +23319,7 @@ const useTableData = (getProps, { setPage, params, tableRef }) => {
23300
23319
  const reload = async () => {
23301
23320
  var _a2;
23302
23321
  if ((_a2 = getProps.value) == null ? void 0 : _a2.api) {
23322
+ /* @__PURE__ */ console.log("22", params.value);
23303
23323
  const res = await getProps.value.api(params.value);
23304
23324
  const isArrayResult = Array.isArray(res);
23305
23325
  let resultItems = isArrayResult ? res : get(res, "records");
@@ -24226,6 +24246,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24226
24246
  api: null,
24227
24247
  columns: { default: () => [] },
24228
24248
  isShowSeq: { type: Boolean, default: true },
24249
+ isShowExpand: { type: Boolean, default: false },
24229
24250
  isCompatible: { type: Boolean, default: false },
24230
24251
  actionColumn: { default: () => {
24231
24252
  return {
@@ -24256,7 +24277,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24256
24277
  columnSeq: { default: () => {
24257
24278
  return {};
24258
24279
  } },
24259
- transDataAfterReload: null
24280
+ transDataAfterReload: null,
24281
+ pagination: { default: {
24282
+ type: [Object, Boolean],
24283
+ default: true
24284
+ } },
24285
+ data: null
24260
24286
  },
24261
24287
  emits: [
24262
24288
  "register",
@@ -24267,6 +24293,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24267
24293
  ],
24268
24294
  setup(__props, { emit: emits }) {
24269
24295
  const props2 = __props;
24296
+ const expandVisibleMethod = ({ row }) => {
24297
+ if (row.childList && row.childList.length > 0) {
24298
+ return true;
24299
+ } else {
24300
+ return false;
24301
+ }
24302
+ };
24270
24303
  const prefixCls2 = "shy-basic-table-plus";
24271
24304
  const getClassName = (className) => {
24272
24305
  return `${prefixCls2}-${className}`;
@@ -24291,7 +24324,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24291
24324
  const getBindValues = computed(() => {
24292
24325
  return deepMergeObjects(basicProps, attrs, getProps.value);
24293
24326
  });
24294
- const { page, setPage } = usePagination();
24327
+ const { page, setPage } = usePagination(getProps);
24295
24328
  const handlePageChange = (current, pageSize) => {
24296
24329
  setPage({ current, pageSize });
24297
24330
  reload();
@@ -24348,6 +24381,15 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24348
24381
  params,
24349
24382
  tableRef
24350
24383
  });
24384
+ const realDataSource = computed(() => {
24385
+ if (dataSource.value && dataSource.value.length > 0) {
24386
+ return dataSource.value;
24387
+ } else if (getProps.value.data && getProps.value.data.length > 0) {
24388
+ return getProps.value.data;
24389
+ } else {
24390
+ return [];
24391
+ }
24392
+ });
24351
24393
  const getSwitchShowText = (column, row) => {
24352
24394
  const {
24353
24395
  unCheckedChildren = "否",
@@ -24502,12 +24544,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24502
24544
  ref_key: "tableRef",
24503
24545
  ref: tableRef
24504
24546
  }, unref(getBindValues), {
24505
- data: unref(dataSource),
24547
+ data: unref(realDataSource),
24506
24548
  onCheckboxAll: handleCheckboxChange,
24507
24549
  onCheckboxChange: handleCheckboxChange,
24508
24550
  onRadioChange: handleRadioChange,
24509
24551
  "show-overflow": "",
24510
- "column-config": { resizable: true }
24552
+ "column-config": { resizable: true },
24553
+ "expand-config": { visibleMethod: expandVisibleMethod }
24511
24554
  }), {
24512
24555
  default: withCtx(() => {
24513
24556
  var _a2, _b, _c, _d, _e, _f;
@@ -24526,8 +24569,19 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24526
24569
  width: "60",
24527
24570
  align: "center"
24528
24571
  })) : createCommentVNode("", true),
24529
- unref(getProps).isShowSeq ? (openBlock(), createBlock(unref(VxeColumn), mergeProps({
24572
+ unref(getProps).isShowExpand ? (openBlock(), createBlock(unref(VxeColumn), {
24530
24573
  key: 2,
24574
+ fixed: "left",
24575
+ type: "expand",
24576
+ width: "40"
24577
+ }, {
24578
+ content: withCtx((data) => [
24579
+ renderSlot(_ctx.$slots, "expand", normalizeProps(guardReactiveProps(data || {})))
24580
+ ]),
24581
+ _: 3
24582
+ })) : createCommentVNode("", true),
24583
+ unref(getProps).isShowSeq ? (openBlock(), createBlock(unref(VxeColumn), mergeProps({
24584
+ key: 3,
24531
24585
  type: "seq",
24532
24586
  width: "60",
24533
24587
  align: "center",
@@ -24599,7 +24653,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24599
24653
  ], 64);
24600
24654
  }), 128)),
24601
24655
  unref(getProps).isShowAction ? (openBlock(), createBlock(unref(VxeColumn), mergeProps({
24602
- key: 3,
24656
+ key: 4,
24603
24657
  title: "操作",
24604
24658
  field: "action",
24605
24659
  align: "center"
@@ -24626,7 +24680,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
24626
24680
  ];
24627
24681
  }),
24628
24682
  _: 3
24629
- }, 16, ["data"])
24683
+ }, 16, ["data", "expand-config"])
24630
24684
  ], 2),
24631
24685
  unref(page).total !== 0 && unref(getProps).isShowPagination ? (openBlock(), createElementBlock("div", {
24632
24686
  key: 2,
package/lib/index.js CHANGED
@@ -23282,6 +23282,10 @@ const basicProps = {
23282
23282
  },
23283
23283
  sortConfig: {
23284
23284
  showIcon: false
23285
+ },
23286
+ pagination: {
23287
+ type: [Object, Boolean],
23288
+ default: true
23285
23289
  }
23286
23290
  };
23287
23291
  const basicColumn = {
@@ -23291,13 +23295,24 @@ const basicColumn = {
23291
23295
  visible: true,
23292
23296
  sortable: false
23293
23297
  };
23294
- const usePagination = () => {
23295
- const page = vue.reactive({
23296
- total: 0,
23297
- current: 1,
23298
- pageSize: 10,
23299
- pageSizeOptions: ["10", "20", "30", "40"]
23300
- });
23298
+ const usePagination = (getProps) => {
23299
+ vue.watch(
23300
+ () => getProps.value.pagination,
23301
+ (pagination) => {
23302
+ if (!utils.isBoolean(pagination) && pagination) {
23303
+ setPage(pagination);
23304
+ }
23305
+ }
23306
+ );
23307
+ const page = vue.reactive(
23308
+ {
23309
+ total: 0,
23310
+ current: 1,
23311
+ pageSize: 10,
23312
+ pageSizeOptions: ["10", "20", "30", "40"],
23313
+ ...getProps.value.pagination
23314
+ }
23315
+ );
23301
23316
  const setPage = (pageInfo) => {
23302
23317
  return new Promise((resolve) => {
23303
23318
  vue.nextTick(() => {
@@ -23314,7 +23329,11 @@ const useTableData = (getProps, { setPage, params, tableRef }) => {
23314
23329
  const dataSource = vue.ref([]);
23315
23330
  const setTableData = (data) => {
23316
23331
  dataSource.value = data.map((item) => {
23317
- item._isEdit = false;
23332
+ if (getProps.value.isUseEdit) {
23333
+ item._isEdit = true;
23334
+ } else {
23335
+ item._isEdit = false;
23336
+ }
23318
23337
  return item;
23319
23338
  });
23320
23339
  };
@@ -23324,6 +23343,7 @@ const useTableData = (getProps, { setPage, params, tableRef }) => {
23324
23343
  const reload = async () => {
23325
23344
  var _a2;
23326
23345
  if ((_a2 = getProps.value) == null ? void 0 : _a2.api) {
23346
+ /* @__PURE__ */ console.log("22", params.value);
23327
23347
  const res = await getProps.value.api(params.value);
23328
23348
  const isArrayResult = Array.isArray(res);
23329
23349
  let resultItems = isArrayResult ? res : get(res, "records");
@@ -24250,6 +24270,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24250
24270
  api: null,
24251
24271
  columns: { default: () => [] },
24252
24272
  isShowSeq: { type: Boolean, default: true },
24273
+ isShowExpand: { type: Boolean, default: false },
24253
24274
  isCompatible: { type: Boolean, default: false },
24254
24275
  actionColumn: { default: () => {
24255
24276
  return {
@@ -24280,7 +24301,12 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24280
24301
  columnSeq: { default: () => {
24281
24302
  return {};
24282
24303
  } },
24283
- transDataAfterReload: null
24304
+ transDataAfterReload: null,
24305
+ pagination: { default: {
24306
+ type: [Object, Boolean],
24307
+ default: true
24308
+ } },
24309
+ data: null
24284
24310
  },
24285
24311
  emits: [
24286
24312
  "register",
@@ -24291,6 +24317,13 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24291
24317
  ],
24292
24318
  setup(__props, { emit: emits }) {
24293
24319
  const props2 = __props;
24320
+ const expandVisibleMethod = ({ row }) => {
24321
+ if (row.childList && row.childList.length > 0) {
24322
+ return true;
24323
+ } else {
24324
+ return false;
24325
+ }
24326
+ };
24294
24327
  const prefixCls2 = "shy-basic-table-plus";
24295
24328
  const getClassName = (className) => {
24296
24329
  return `${prefixCls2}-${className}`;
@@ -24315,7 +24348,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24315
24348
  const getBindValues = vue.computed(() => {
24316
24349
  return utils.deepMergeObjects(basicProps, attrs, getProps.value);
24317
24350
  });
24318
- const { page, setPage } = usePagination();
24351
+ const { page, setPage } = usePagination(getProps);
24319
24352
  const handlePageChange = (current, pageSize) => {
24320
24353
  setPage({ current, pageSize });
24321
24354
  reload();
@@ -24372,6 +24405,15 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24372
24405
  params,
24373
24406
  tableRef
24374
24407
  });
24408
+ const realDataSource = vue.computed(() => {
24409
+ if (dataSource.value && dataSource.value.length > 0) {
24410
+ return dataSource.value;
24411
+ } else if (getProps.value.data && getProps.value.data.length > 0) {
24412
+ return getProps.value.data;
24413
+ } else {
24414
+ return [];
24415
+ }
24416
+ });
24375
24417
  const getSwitchShowText = (column, row) => {
24376
24418
  const {
24377
24419
  unCheckedChildren = "否",
@@ -24526,12 +24568,13 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24526
24568
  ref_key: "tableRef",
24527
24569
  ref: tableRef
24528
24570
  }, vue.unref(getBindValues), {
24529
- data: vue.unref(dataSource),
24571
+ data: vue.unref(realDataSource),
24530
24572
  onCheckboxAll: handleCheckboxChange,
24531
24573
  onCheckboxChange: handleCheckboxChange,
24532
24574
  onRadioChange: handleRadioChange,
24533
24575
  "show-overflow": "",
24534
- "column-config": { resizable: true }
24576
+ "column-config": { resizable: true },
24577
+ "expand-config": { visibleMethod: expandVisibleMethod }
24535
24578
  }), {
24536
24579
  default: vue.withCtx(() => {
24537
24580
  var _a2, _b, _c, _d, _e, _f;
@@ -24550,8 +24593,19 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24550
24593
  width: "60",
24551
24594
  align: "center"
24552
24595
  })) : vue.createCommentVNode("", true),
24553
- vue.unref(getProps).isShowSeq ? (vue.openBlock(), vue.createBlock(vue.unref(vxeTable.VxeColumn), vue.mergeProps({
24596
+ vue.unref(getProps).isShowExpand ? (vue.openBlock(), vue.createBlock(vue.unref(vxeTable.VxeColumn), {
24554
24597
  key: 2,
24598
+ fixed: "left",
24599
+ type: "expand",
24600
+ width: "40"
24601
+ }, {
24602
+ content: vue.withCtx((data) => [
24603
+ vue.renderSlot(_ctx.$slots, "expand", vue.normalizeProps(vue.guardReactiveProps(data || {})))
24604
+ ]),
24605
+ _: 3
24606
+ })) : vue.createCommentVNode("", true),
24607
+ vue.unref(getProps).isShowSeq ? (vue.openBlock(), vue.createBlock(vue.unref(vxeTable.VxeColumn), vue.mergeProps({
24608
+ key: 3,
24555
24609
  type: "seq",
24556
24610
  width: "60",
24557
24611
  align: "center",
@@ -24623,7 +24677,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24623
24677
  ], 64);
24624
24678
  }), 128)),
24625
24679
  vue.unref(getProps).isShowAction ? (vue.openBlock(), vue.createBlock(vue.unref(vxeTable.VxeColumn), vue.mergeProps({
24626
- key: 3,
24680
+ key: 4,
24627
24681
  title: "操作",
24628
24682
  field: "action",
24629
24683
  align: "center"
@@ -24650,7 +24704,7 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
24650
24704
  ];
24651
24705
  }),
24652
24706
  _: 3
24653
- }, 16, ["data"])
24707
+ }, 16, ["data", "expand-config"])
24654
24708
  ], 2),
24655
24709
  vue.unref(page).total !== 0 && vue.unref(getProps).isShowPagination ? (vue.openBlock(), vue.createElementBlock("div", {
24656
24710
  key: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "2.15.15",
3
+ "version": "2.15.17",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",