@dt-frames/ui 1.0.16 → 1.0.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.
@@ -24,6 +24,7 @@ declare const _default: import("vue").DefineComponent<{
24
24
  default: () => BasicColumn;
25
25
  };
26
26
  index: NumberConstructor;
27
+ dataSource: PropType<Recordable<any>[]>;
27
28
  }, {
28
29
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
29
30
  value: {
@@ -48,6 +49,7 @@ declare const _default: import("vue").DefineComponent<{
48
49
  default: () => BasicColumn;
49
50
  };
50
51
  index: NumberConstructor;
52
+ dataSource: PropType<Recordable<any>[]>;
51
53
  }>> & {
52
54
  [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any);
53
55
  }>>;
@@ -81,6 +83,7 @@ declare const _default: import("vue").DefineComponent<{
81
83
  default: () => BasicColumn;
82
84
  };
83
85
  index: NumberConstructor;
86
+ dataSource: PropType<Recordable<any>[]>;
84
87
  }>>, {
85
88
  value: string;
86
89
  column: BasicColumn;
@@ -1,5 +1,5 @@
1
1
  import { BasicColumn } from "../../types/table.type";
2
- declare function renderEditCell(column: BasicColumn): ({ text: value, record, index }: {
2
+ declare function renderEditCell(column: BasicColumn, dataSource: any): ({ text: value, record, index }: {
3
3
  text: any;
4
4
  record: any;
5
5
  index: any;
@@ -268,6 +268,9 @@ declare const _default: import("vue").DefineComponent<{
268
268
  rowKey: string;
269
269
  columns: import("./types/table.type").BasicColumn[];
270
270
  tableLayout: string;
271
+ class: (string | {
272
+ 'dt-table-no-pagation': boolean;
273
+ })[];
271
274
  customRow: (record: Recordable<any>, index: number) => {
272
275
  onClick: (e: any) => void;
273
276
  onDblclick: (event: Event) => void;
@@ -33,6 +33,8 @@ export declare type SorterResult = {
33
33
  };
34
34
  export declare type CellFormat = ((record: Recordable, index: number, text: string) => any) | {
35
35
  dict: DictType;
36
+ } | {
37
+ struc: string;
36
38
  } | {
37
39
  number: string;
38
40
  } | {
@@ -1284,6 +1284,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
1284
1284
  rowKey: string;
1285
1285
  columns: import("../../table/src/types/table.type").BasicColumn[];
1286
1286
  tableLayout: string;
1287
+ class: (string | {
1288
+ 'dt-table-no-pagation': boolean;
1289
+ })[];
1287
1290
  customRow: (record: import("@dt-frames/core").Recordable<any>, index: number) => {
1288
1291
  onClick: (e: any) => void;
1289
1292
  onDblclick: (event: Event) => void;
package/es/index.js CHANGED
@@ -3312,7 +3312,7 @@ var _sfc_main$P = defineComponent({
3312
3312
  error("\u8BF7\u914D\u7F6Erender\u51FD\u6570");
3313
3313
  return;
3314
3314
  }
3315
- return createVNode(Col, {
3315
+ return unref(getShow) && createVNode(Col, {
3316
3316
  "span": 24
3317
3317
  }, _isSlot(_slot2 = render2(values)) ? _slot2 : {
3318
3318
  default: () => [_slot2]
@@ -5284,7 +5284,8 @@ var _sfc_main$I = defineComponent({
5284
5284
  type: Object,
5285
5285
  default: () => ({})
5286
5286
  },
5287
- index: Number
5287
+ index: Number,
5288
+ dataSource: Array
5288
5289
  },
5289
5290
  setup(props) {
5290
5291
  const table = getTableInstance();
@@ -5317,6 +5318,9 @@ var _sfc_main$I = defineComponent({
5317
5318
  }
5318
5319
  return "\u8BF7\u9009\u62E9";
5319
5320
  };
5321
+ const setTableValue = () => {
5322
+ props.dataSource[props.index][props.column.dataIndex] = unref(currentValueRef);
5323
+ };
5320
5324
  const getComponentProps = computed(() => {
5321
5325
  var _a, _b, _c;
5322
5326
  const isCheckValue = unref(getIsCheckComp);
@@ -5342,7 +5346,8 @@ var _sfc_main$I = defineComponent({
5342
5346
  getPopupContainer: () => document.body,
5343
5347
  placeholder: createPlaceholderMessage(unref(getComponent)),
5344
5348
  ...omit(compProps, "onChange"),
5345
- [valueField]: value
5349
+ [valueField]: value,
5350
+ onBlur: setTableValue
5346
5351
  };
5347
5352
  });
5348
5353
  async function handleChange(e) {
@@ -5362,10 +5367,14 @@ var _sfc_main$I = defineComponent({
5362
5367
  const onChange = (_a = unref(getComponentProps)) == null ? void 0 : _a.onChange;
5363
5368
  if (onChange && isFunction$1(onChange))
5364
5369
  onChange(...arguments);
5370
+ if (!["Input", "InputNumber"].includes(props.column.editComponent)) {
5371
+ setTableValue();
5372
+ }
5365
5373
  (_b = table.emit) == null ? void 0 : _b.call(table, "edit-change", {
5366
5374
  column: props.column,
5367
5375
  value: unref(currentValueRef),
5368
- record: toRaw(props.record)
5376
+ record: toRaw(props.record),
5377
+ index: props.index
5369
5378
  });
5370
5379
  handleSubmitRule();
5371
5380
  }
@@ -5429,7 +5438,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
5429
5438
  ]);
5430
5439
  }
5431
5440
  var EditableCell = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["render", _sfc_render$3]]);
5432
- function renderEditCell(column) {
5441
+ function renderEditCell(column, dataSource) {
5433
5442
  return ({ text: value, record, index }) => {
5434
5443
  record.onValid = async () => {
5435
5444
  if (isArray$1(record == null ? void 0 : record.validCbs)) {
@@ -5463,7 +5472,8 @@ function renderEditCell(column) {
5463
5472
  value,
5464
5473
  record,
5465
5474
  column,
5466
- index
5475
+ index,
5476
+ dataSource
5467
5477
  });
5468
5478
  };
5469
5479
  }
@@ -5731,7 +5741,7 @@ function useColumns(propsRef, getPaginationRef) {
5731
5741
  const columns = cloneDeep(viewColumns);
5732
5742
  return columns.filter((column) => isIfShow(column)).map((column) => {
5733
5743
  if (column.edit) {
5734
- column.customRender = renderEditCell(column);
5744
+ column.customRender = renderEditCell(column, unref(propsRef).dataSource);
5735
5745
  }
5736
5746
  return column;
5737
5747
  });
@@ -6725,6 +6735,12 @@ const _sfc_main$A = defineComponent({
6725
6735
  const getProps = computed(() => {
6726
6736
  return { ...props, ...unref(innerPropsRef) };
6727
6737
  });
6738
+ const tableClass = computed(() => {
6739
+ return [
6740
+ "dt-table",
6741
+ { "dt-table-no-pagation": !unref(getProps).pagination }
6742
+ ];
6743
+ });
6728
6744
  const { getLoading, setLoading } = useLoading(getProps);
6729
6745
  const { getPaginationInfo, setPagination, getPagination, getShowPagination, setShowPagination } = usePagination(getProps);
6730
6746
  const {
@@ -6791,6 +6807,7 @@ const _sfc_main$A = defineComponent({
6791
6807
  rowKey: unref(getProps).rowKey,
6792
6808
  columns: unref(getViewColumns),
6793
6809
  tableLayout: "fixed",
6810
+ class: unref(tableClass),
6794
6811
  customRow
6795
6812
  };
6796
6813
  });
@@ -6820,10 +6837,7 @@ const _sfc_main$A = defineComponent({
6820
6837
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
6821
6838
  const _component_TableRender = resolveComponent("TableRender");
6822
6839
  const _component_Table = resolveComponent("Table");
6823
- return openBlock(), createBlock(_component_Table, mergeProps({
6824
- ref: "tableElRef",
6825
- class: "dt-table"
6826
- }, _ctx.getBind, {
6840
+ return openBlock(), createBlock(_component_Table, mergeProps({ ref: "tableElRef" }, _ctx.getBind, {
6827
6841
  rowClassName: _ctx.getRowClassName,
6828
6842
  onChange: _ctx.handleTableChange,
6829
6843
  onResizeColumn: _ctx.handleResizeColumn
@@ -172,6 +172,10 @@
172
172
  }
173
173
  }
174
174
 
175
+ .dt-table-no-pagation .ant-table-container {
176
+ border-bottom: 1px solid #f0f0f0;
177
+ }
178
+
175
179
  .edit-cell-rule-popover .ant-popover-inner-content{
176
180
  padding: 4px 8px;
177
181
  color: #ed6f6f;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-frames/ui",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "keywords": [
5
5
  "ui",
6
6
  "dt-ui"