@jetlinks-web/components 2.6.8 → 2.6.10

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.
@@ -29,6 +29,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
29
29
  "onBeforeUnmount": "setup-const",
30
30
  "nextTick": "setup-const",
31
31
  "Empty": "setup-const",
32
+ "CellRender": "setup-const",
32
33
  "props": "setup-reactive-const",
33
34
  "emit": "setup-const",
34
35
  "viewScrollRef": "setup-ref",
@@ -47,7 +48,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
47
48
  "rowClick": "setup-const",
48
49
  "updateSelectedKeys": "setup-const"
49
50
  } */
50
- import { normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createCommentVNode as _createCommentVNode, withModifiers as _withModifiers, normalizeClass as _normalizeClass, createVNode as _createVNode } from "vue";
51
+ import { normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createCommentVNode as _createCommentVNode, createBlock as _createBlock, withModifiers as _withModifiers, normalizeClass as _normalizeClass, createVNode as _createVNode } from "vue";
51
52
  const _hoisted_1 = { style: { position: 'relative' } };
52
53
  const _hoisted_2 = ["data-row-key", "onContextmenu", "onClick"];
53
54
  const _hoisted_3 = {
@@ -69,6 +70,7 @@ import { randomString } from "@jetlinks-web/utils";
69
70
  import { bodyProps } from "./props";
70
71
  import { ref, reactive, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue';
71
72
  import Empty from '../Empty/Empty.js';
73
+ import CellRender from './CellRender.js';
72
74
  const __sfc_main__ = Object.assign({
73
75
  name: 'JEditTableBody'
74
76
  }, {
@@ -254,7 +256,17 @@ const __sfc_main__ = Object.assign({
254
256
  index: item.__dataIndex,
255
257
  column: column
256
258
  }, () => [
257
- _createTextVNode(_toDisplayString(item[column.dataIndex]), 1 /* TEXT */)
259
+ (column.customRender)
260
+ ? (_openBlock(), _createBlock(CellRender, {
261
+ key: 0,
262
+ record: item,
263
+ value: item[column.dataIndex],
264
+ index: item.__dataIndex,
265
+ "render-fn": column.customRender
266
+ }, null, 8 /* PROPS */, ["record", "value", "index", "render-fn"]))
267
+ : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
268
+ _createTextVNode(_toDisplayString(item[column.dataIndex]), 1 /* TEXT */)
269
+ ], 64 /* STABLE_FRAGMENT */))
258
270
  ])
259
271
  ]))
260
272
  ], 4 /* STYLE */));
@@ -0,0 +1,12 @@
1
+ /* Analyzed bindings: {} */
2
+ import { defineComponent } from 'vue';
3
+ const __sfc_main__ = defineComponent({
4
+ name: "CellRender",
5
+ props: ['renderFn', 'value', 'record', 'index'],
6
+ setup(props) {
7
+ return () => {
8
+ return props.renderFn(props.value, props.record, props.index);
9
+ };
10
+ }
11
+ });
12
+ export default __sfc_main__;
@@ -15,6 +15,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
15
15
  }
16
16
  } return value; }
17
17
  /* Analyzed bindings: {
18
+ "searchColumns": "props",
18
19
  "serial": "props",
19
20
  "validateRowKey": "props",
20
21
  "readonly": "props",
@@ -84,6 +85,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
84
85
  "removeFieldError": "setup-const",
85
86
  "addFieldError": "setup-const",
86
87
  "scrollWidth": "setup-ref",
88
+ "handleColumns": "setup-const",
87
89
  "onResize": "setup-const",
88
90
  "onScrollDown": "setup-const",
89
91
  "rightMenu": "setup-const",
@@ -117,6 +119,10 @@ const __sfc_main__ = Object.assign({
117
119
  props: {
118
120
  ...tableProps(),
119
121
  ...bodyProps(),
122
+ searchColumns: {
123
+ type: Array,
124
+ default: undefined
125
+ },
120
126
  serial: {
121
127
  type: [Object, Boolean],
122
128
  default: () => ({
@@ -304,13 +310,7 @@ const __sfc_main__ = Object.assign({
304
310
  const scrollWidth = computed(() => {
305
311
  return (props.dataSource.length * props.cellHeight) > props.height ? scrollDefaultWidth.value : 0;
306
312
  });
307
- function onResize({ width = 0 }) {
308
- const _width = width - scrollWidth.value;
309
- tableStyle.width = width || '100%';
310
- // const viewportDom = document.querySelector('.jetlinks-edit-table-body-viewport')
311
- // const viewportDivDom = viewportDom.querySelector('div')
312
- //
313
- // scrollDefaultWidth.value = viewportDom.offsetWidth - viewportDivDom.offsetWidth
313
+ const handleColumns = () => {
314
314
  let newColumns = [...props.columns];
315
315
  if (props.serial) {
316
316
  const serial = {
@@ -326,7 +326,16 @@ const __sfc_main__ = Object.assign({
326
326
  };
327
327
  newColumns = [serial, ...props.columns];
328
328
  }
329
- myColumns.value = handleColumnsWidth(newColumns, _width);
329
+ myColumns.value = handleColumnsWidth(newColumns, tableStyle.width - scrollWidth.value);
330
+ };
331
+ function onResize({ width = 0 }) {
332
+ const _width = width - scrollWidth.value;
333
+ tableStyle.width = width || '100%';
334
+ // const viewportDom = document.querySelector('.jetlinks-edit-table-body-viewport')
335
+ // const viewportDivDom = viewportDom.querySelector('div')
336
+ //
337
+ // scrollDefaultWidth.value = viewportDom.offsetWidth - viewportDivDom.offsetWidth
338
+ handleColumns();
330
339
  }
331
340
  const onScrollDown = (len) => {
332
341
  emit('scrollDown', len);
@@ -393,6 +402,9 @@ const __sfc_main__ = Object.assign({
393
402
  watch(() => scrollWidth.value, () => {
394
403
  onResize({ width: tableStyle.width });
395
404
  });
405
+ watch(() => [JSON.stringify(props.columns), tableStyle.width], () => {
406
+ handleColumns();
407
+ });
396
408
  useFormContext({
397
409
  dataSource: computed(() => {
398
410
  return props.dataSource;
@@ -435,8 +447,9 @@ const __sfc_main__ = Object.assign({
435
447
  }, [
436
448
  _createVNode(Header, {
437
449
  columns: myColumns.value,
450
+ searchColumns: __props.searchColumns,
438
451
  style: _normalizeStyle({ width: tableStyle.width })
439
- }, null, 8 /* PROPS */, ["columns", "style"])
452
+ }, null, 8 /* PROPS */, ["columns", "searchColumns", "style"])
440
453
  ], 4 /* STYLE */),
441
454
  _createElementVNode("div", {
442
455
  class: "jetlinks-edit-table-body",
@@ -24,26 +24,30 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
24
24
  "reactive": "setup-const",
25
25
  "defineOptions": "setup-const",
26
26
  "useTableTool": "setup-maybe-ref",
27
+ "HeaderItemRender": "setup-const",
27
28
  "props": "setup-reactive-const",
28
29
  "tableTool": "setup-maybe-ref",
29
30
  "searchData": "setup-reactive-const",
30
31
  "showFilter": "setup-const",
31
32
  "sortClick": "setup-const"
32
33
  } */
33
- import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createBlock as _createBlock, unref as _unref, mergeProps as _mergeProps, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle } from "vue";
34
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, unref as _unref, mergeProps as _mergeProps, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle } from "vue";
34
35
  const _hoisted_1 = ["id"];
35
36
  const _hoisted_2 = { class: "table-header-cell-title" };
36
- const _hoisted_3 = {
37
+ const _hoisted_3 = { class: "cell-title-box" };
38
+ const _hoisted_4 = { key: 1 };
39
+ const _hoisted_5 = {
37
40
  key: 0,
38
41
  class: "header-cell-required"
39
42
  };
40
- const _hoisted_4 = {
43
+ const _hoisted_6 = {
41
44
  key: 0,
42
45
  class: "table-header-cell-trigger"
43
46
  };
44
47
  import { SearchModal, Sort } from './components/Search';
45
48
  import { reactive, } from 'vue';
46
49
  import { useTableTool } from "./hooks";
50
+ import HeaderItemRender from './HeaderRender.js';
47
51
  const __sfc_main__ = Object.assign({
48
52
  name: 'JEditTableHeader'
49
53
  }, {
@@ -95,13 +99,21 @@ const __sfc_main__ = Object.assign({
95
99
  class: _normalizeClass({ 'jetlinks-edit-table-header-cell-box': true, 'header-cell-box-tool': !!(item.sort || item.filter) })
96
100
  }, [
97
101
  _createElementVNode("div", _hoisted_2, [
98
- _createElementVNode("span", null, _toDisplayString(item.title), 1 /* TEXT */),
102
+ _createElementVNode("div", _hoisted_3, [
103
+ (item.render)
104
+ ? (_openBlock(), _createBlock(HeaderItemRender, {
105
+ key: 0,
106
+ "render-fn": item.render,
107
+ value: item.title
108
+ }, null, 8 /* PROPS */, ["render-fn", "value"]))
109
+ : (_openBlock(), _createElementBlock("span", _hoisted_4, _toDisplayString(item.title), 1 /* TEXT */))
110
+ ]),
99
111
  (_optionalChain([item, 'access', _ => _.form, 'optionalAccess', _2 => _2.required]))
100
- ? (_openBlock(), _createElementBlock("span", _hoisted_3, "*"))
112
+ ? (_openBlock(), _createElementBlock("span", _hoisted_5, "*"))
101
113
  : _createCommentVNode("v-if", true)
102
114
  ]),
103
115
  (!!(item.sort || item.filter))
104
- ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
116
+ ? (_openBlock(), _createElementBlock("div", _hoisted_6, [
105
117
  (item.filter)
106
118
  ? (_openBlock(), _createBlock(_component_AIcon, {
107
119
  key: 0,
@@ -128,10 +140,9 @@ const __sfc_main__ = Object.assign({
128
140
  ? (_openBlock(), _createBlock(_unref(SearchModal), {
129
141
  key: 0,
130
142
  searchKey: searchData.key,
131
- rowKey: _ctx.rowKey,
132
143
  columns: __props.searchColumns,
133
144
  onClose: _cache[0] || (_cache[0] = $event => (searchData.visible = false))
134
- }, null, 8 /* PROPS */, ["searchKey", "rowKey", "columns"]))
145
+ }, null, 8 /* PROPS */, ["searchKey", "columns"]))
135
146
  : _createCommentVNode("v-if", true)
136
147
  ], 4 /* STYLE */));
137
148
  };
@@ -0,0 +1,12 @@
1
+ /* Analyzed bindings: {} */
2
+ import { defineComponent } from 'vue';
3
+ const __sfc_main__ = defineComponent({
4
+ name: "HeaderItemRender",
5
+ props: ['renderFn', 'value'],
6
+ setup(props) {
7
+ return () => {
8
+ return props.renderFn(props.value);
9
+ };
10
+ }
11
+ });
12
+ export default __sfc_main__;
@@ -23,7 +23,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
23
23
  "useTableTool": "setup-maybe-ref",
24
24
  "useGroupOptions": "setup-maybe-ref",
25
25
  "ref": "setup-const",
26
- "reactive": "setup-const",
26
+ "computed": "setup-const",
27
27
  "defineOptions": "setup-const",
28
28
  "Ellipsis": "setup-const",
29
29
  "DragModal": "setup-const",
@@ -47,7 +47,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
47
47
  "tableHeight": "setup-ref",
48
48
  "selectedRowKeys": "setup-ref",
49
49
  "tableRef": "setup-ref",
50
- "myColumns": "setup-reactive-const",
50
+ "myColumns": "setup-ref",
51
51
  "selectedTableRow": "setup-const",
52
52
  "handleFilterArray": "setup-const",
53
53
  "search": "setup-const",
@@ -68,7 +68,7 @@ const _hoisted_6 = { key: 1 };
68
68
  const _hoisted_7 = { class: "jetlinks-table-search-result-total" };
69
69
  import Table from '../../EditTable.js';
70
70
  import { useTableDataSource, useTableOpenGroup, useTableTool, useGroupOptions } from "../../context";
71
- import { ref, reactive, } from "vue";
71
+ import { ref, computed, } from "vue";
72
72
  import Ellipsis from '../../../Ellipsis/Ellipsis.js';
73
73
  import DragModal from '../../../DragModal/DragModal.js';
74
74
  import { useLocaleReceiver } from "../../../LocaleReciver/index";
@@ -103,16 +103,24 @@ const __sfc_main__ = Object.assign({
103
103
  const tableHeight = ref(230);
104
104
  const selectedRowKeys = ref([]);
105
105
  const tableRef = ref();
106
- const myColumns = reactive([
107
- {
108
- title: contextLocale.value.columns.sign,
109
- dataIndex: 'id',
110
- },
111
- {
112
- title: contextLocale.value.columns.name,
113
- dataIndex: 'name',
106
+ const myColumns = computed(() => {
107
+ if (props.columns) {
108
+ return props.columns.map(item => ({
109
+ title: item.title,
110
+ dataIndex: item.dataIndex
111
+ }));
114
112
  }
115
- ]);
113
+ return [
114
+ {
115
+ title: contextLocale.value.columns.sign,
116
+ dataIndex: 'id',
117
+ },
118
+ {
119
+ title: contextLocale.value.columns.name,
120
+ dataIndex: 'name',
121
+ }
122
+ ];
123
+ });
116
124
  const selectedTableRow = (record) => {
117
125
  tableTool.scrollTo({
118
126
  ...record,
@@ -272,7 +280,7 @@ const __sfc_main__ = Object.assign({
272
280
  ref_key: "tableRef",
273
281
  ref: tableRef,
274
282
  "data-source": filterArray.value,
275
- columns: __props.columns || myColumns,
283
+ columns: myColumns.value,
276
284
  height: tableHeight.value,
277
285
  disableMenu: false,
278
286
  cellHeight: 36,
@@ -42,7 +42,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
42
42
  "onDesc": "setup-const"
43
43
  } */
44
44
  import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
45
- const _withScopeId = n => (_pushScopeId("data-v-1744360876126"), n = n(), _popScopeId(), n);
45
+ const _withScopeId = n => (_pushScopeId("data-v-1744627839929"), n = n(), _popScopeId(), n);
46
46
  const _hoisted_1 = { class: "jetlinks-table-sort-content" };
47
47
  const _hoisted_2 = { class: "jetlinks-table-sort-title" };
48
48
  const _hoisted_3 = { class: "table-sort-body" };
@@ -38,10 +38,6 @@ export var bodyProps = function bodyProps() {
38
38
  return [];
39
39
  }
40
40
  },
41
- searchColumns: {
42
- type: Array,
43
- default: undefined
44
- },
45
41
  cellHeight: {
46
42
  type: Number,
47
43
  default: 50
@@ -26,6 +26,11 @@
26
26
  display: flex;
27
27
  align-items: center;
28
28
  font-weight: 600;
29
+ gap: 4px;
30
+
31
+ .cell-title-box {
32
+ flex: 1 1 auto;
33
+ }
29
34
  }
30
35
 
31
36
  .header-cell-required {
@@ -116,6 +116,10 @@
116
116
  display: flex;
117
117
  align-items: center;
118
118
  font-weight: 600;
119
+ gap: 4px;
120
+ }
121
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .table-header-cell-title .cell-title-box {
122
+ flex: 1 1 auto;
119
123
  }
120
124
  .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .header-cell-required {
121
125
  color: #ff4d4f;
@@ -1,5 +1,4 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import { omit } from "lodash-es";
1
+ import { cloneDeep, omit } from "lodash-es";
3
2
  /**
4
3
  * 规则收集器,收集columns中的rules和watch
5
4
  * @param columns
@@ -23,7 +22,8 @@ export var handlePureRecord = function handlePureRecord(record) {
23
22
  return omit(record, ['__serial', '__index', '__top', '__selected', '__key', '__dataIndex']);
24
23
  };
25
24
  export var handleColumnsWidth = function handleColumnsWidth(columns, warpWidth) {
26
- var newColumns = _toConsumableArray(columns);
25
+ // let newColumns = [...columns]
26
+ var newColumns = cloneDeep(columns);
27
27
  var noWidthLen = 0; // 没有width属性的长度
28
28
  var hasWidthCount = 0; // 有width属性的合计
29
29
  var average = 0; // 每个column宽度
@@ -9,7 +9,7 @@
9
9
  } */
10
10
  import { defineComponent as _defineComponent } from 'vue';
11
11
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
12
- const _withScopeId = n => (_pushScopeId("data-v-1744360873449"), n = n(), _popScopeId(), n);
12
+ const _withScopeId = n => (_pushScopeId("data-v-1744627832838"), n = n(), _popScopeId(), n);
13
13
  const _hoisted_1 = { class: "full-page-warp-content" };
14
14
  import { ref, inject } from 'vue';
15
15
  import { useElementBounding } from '@vueuse/core';
@@ -55,8 +55,7 @@ var PermissionButton = defineComponent({
55
55
  components: undefined
56
56
  });
57
57
  var permission = computed(function () {
58
- var hasOwnPrototype = Object.prototype.hasOwnProperty.call(instance.props, 'hasPermission');
59
- if (props.hasPermission === true || !hasOwnPrototype) {
58
+ if (props.hasPermission === true || props.hasPermission === undefined) {
60
59
  return true;
61
60
  }
62
61
  return hasPerm.value;
@@ -23,7 +23,7 @@
23
23
  } */
24
24
  import { defineComponent as _defineComponent } from 'vue';
25
25
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
26
- const _withScopeId = n => (_pushScopeId("data-v-1744360875956"), n = n(), _popScopeId(), n);
26
+ const _withScopeId = n => (_pushScopeId("data-v-1744627839108"), n = n(), _popScopeId(), n);
27
27
  const _hoisted_1 = {
28
28
  key: 0,
29
29
  style: { "width": "240px" }
package/es/Search/Item.js CHANGED
@@ -80,7 +80,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
80
80
  } */
81
81
  import { defineComponent as _defineComponent } from 'vue';
82
82
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
83
- const _withScopeId = n => (_pushScopeId("data-v-1744360874856"), n = n(), _popScopeId(), n);
83
+ const _withScopeId = n => (_pushScopeId("data-v-1744627835608"), n = n(), _popScopeId(), n);
84
84
  const _hoisted_1 = { class: "JSearch-item" };
85
85
  const _hoisted_2 = {
86
86
  key: 0,
@@ -4940,6 +4940,10 @@ span.ant-radio + * {
4940
4940
  display: flex;
4941
4941
  align-items: center;
4942
4942
  font-weight: 600;
4943
+ gap: 4px;
4944
+ }
4945
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .table-header-cell-title .cell-title-box {
4946
+ flex: 1 1 auto;
4943
4947
  }
4944
4948
  .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .header-cell-required {
4945
4949
  color: #ff4d4f;
@@ -29,6 +29,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
29
29
  "onBeforeUnmount": "setup-const",
30
30
  "nextTick": "setup-const",
31
31
  "Empty": "setup-const",
32
+ "CellRender": "setup-const",
32
33
  "props": "setup-reactive-const",
33
34
  "emit": "setup-const",
34
35
  "viewScrollRef": "setup-ref",
@@ -47,7 +48,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
47
48
  "rowClick": "setup-const",
48
49
  "updateSelectedKeys": "setup-const"
49
50
  } */
50
- import { normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createCommentVNode as _createCommentVNode, withModifiers as _withModifiers, normalizeClass as _normalizeClass, createVNode as _createVNode } from "vue";
51
+ import { normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createCommentVNode as _createCommentVNode, createBlock as _createBlock, withModifiers as _withModifiers, normalizeClass as _normalizeClass, createVNode as _createVNode } from "vue";
51
52
  const _hoisted_1 = { style: { position: 'relative' } };
52
53
  const _hoisted_2 = ["data-row-key", "onContextmenu", "onClick"];
53
54
  const _hoisted_3 = {
@@ -69,6 +70,7 @@ import { randomString } from "@jetlinks-web/utils";
69
70
  import { bodyProps } from "./props";
70
71
  import { ref, reactive, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue';
71
72
  import Empty from '../Empty/Empty.js';
73
+ import CellRender from './CellRender.js';
72
74
  const __sfc_main__ = Object.assign({
73
75
  name: 'JEditTableBody'
74
76
  }, {
@@ -254,7 +256,17 @@ const __sfc_main__ = Object.assign({
254
256
  index: item.__dataIndex,
255
257
  column: column
256
258
  }, () => [
257
- _createTextVNode(_toDisplayString(item[column.dataIndex]), 1 /* TEXT */)
259
+ (column.customRender)
260
+ ? (_openBlock(), _createBlock(CellRender, {
261
+ key: 0,
262
+ record: item,
263
+ value: item[column.dataIndex],
264
+ index: item.__dataIndex,
265
+ "render-fn": column.customRender
266
+ }, null, 8 /* PROPS */, ["record", "value", "index", "render-fn"]))
267
+ : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
268
+ _createTextVNode(_toDisplayString(item[column.dataIndex]), 1 /* TEXT */)
269
+ ], 64 /* STABLE_FRAGMENT */))
258
270
  ])
259
271
  ]))
260
272
  ], 4 /* STYLE */));
@@ -0,0 +1,12 @@
1
+ /* Analyzed bindings: {} */
2
+ import { defineComponent } from 'vue';
3
+ const __sfc_main__ = defineComponent({
4
+ name: "CellRender",
5
+ props: ['renderFn', 'value', 'record', 'index'],
6
+ setup(props) {
7
+ return () => {
8
+ return props.renderFn(props.value, props.record, props.index);
9
+ };
10
+ }
11
+ });
12
+ export default __sfc_main__;
@@ -15,6 +15,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
15
15
  }
16
16
  } return value; }
17
17
  /* Analyzed bindings: {
18
+ "searchColumns": "props",
18
19
  "serial": "props",
19
20
  "validateRowKey": "props",
20
21
  "readonly": "props",
@@ -84,6 +85,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
84
85
  "removeFieldError": "setup-const",
85
86
  "addFieldError": "setup-const",
86
87
  "scrollWidth": "setup-ref",
88
+ "handleColumns": "setup-const",
87
89
  "onResize": "setup-const",
88
90
  "onScrollDown": "setup-const",
89
91
  "rightMenu": "setup-const",
@@ -117,6 +119,10 @@ const __sfc_main__ = Object.assign({
117
119
  props: {
118
120
  ...tableProps(),
119
121
  ...bodyProps(),
122
+ searchColumns: {
123
+ type: Array,
124
+ default: undefined
125
+ },
120
126
  serial: {
121
127
  type: [Object, Boolean],
122
128
  default: () => ({
@@ -304,13 +310,7 @@ const __sfc_main__ = Object.assign({
304
310
  const scrollWidth = computed(() => {
305
311
  return (props.dataSource.length * props.cellHeight) > props.height ? scrollDefaultWidth.value : 0;
306
312
  });
307
- function onResize({ width = 0 }) {
308
- const _width = width - scrollWidth.value;
309
- tableStyle.width = width || '100%';
310
- // const viewportDom = document.querySelector('.jetlinks-edit-table-body-viewport')
311
- // const viewportDivDom = viewportDom.querySelector('div')
312
- //
313
- // scrollDefaultWidth.value = viewportDom.offsetWidth - viewportDivDom.offsetWidth
313
+ const handleColumns = () => {
314
314
  let newColumns = [...props.columns];
315
315
  if (props.serial) {
316
316
  const serial = {
@@ -326,7 +326,16 @@ const __sfc_main__ = Object.assign({
326
326
  };
327
327
  newColumns = [serial, ...props.columns];
328
328
  }
329
- myColumns.value = handleColumnsWidth(newColumns, _width);
329
+ myColumns.value = handleColumnsWidth(newColumns, tableStyle.width - scrollWidth.value);
330
+ };
331
+ function onResize({ width = 0 }) {
332
+ const _width = width - scrollWidth.value;
333
+ tableStyle.width = width || '100%';
334
+ // const viewportDom = document.querySelector('.jetlinks-edit-table-body-viewport')
335
+ // const viewportDivDom = viewportDom.querySelector('div')
336
+ //
337
+ // scrollDefaultWidth.value = viewportDom.offsetWidth - viewportDivDom.offsetWidth
338
+ handleColumns();
330
339
  }
331
340
  const onScrollDown = (len) => {
332
341
  emit('scrollDown', len);
@@ -393,6 +402,9 @@ const __sfc_main__ = Object.assign({
393
402
  watch(() => scrollWidth.value, () => {
394
403
  onResize({ width: tableStyle.width });
395
404
  });
405
+ watch(() => [JSON.stringify(props.columns), tableStyle.width], () => {
406
+ handleColumns();
407
+ });
396
408
  useFormContext({
397
409
  dataSource: computed(() => {
398
410
  return props.dataSource;
@@ -435,8 +447,9 @@ const __sfc_main__ = Object.assign({
435
447
  }, [
436
448
  _createVNode(Header, {
437
449
  columns: myColumns.value,
450
+ searchColumns: __props.searchColumns,
438
451
  style: _normalizeStyle({ width: tableStyle.width })
439
- }, null, 8 /* PROPS */, ["columns", "style"])
452
+ }, null, 8 /* PROPS */, ["columns", "searchColumns", "style"])
440
453
  ], 4 /* STYLE */),
441
454
  _createElementVNode("div", {
442
455
  class: "jetlinks-edit-table-body",
@@ -24,26 +24,30 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
24
24
  "reactive": "setup-const",
25
25
  "defineOptions": "setup-const",
26
26
  "useTableTool": "setup-maybe-ref",
27
+ "HeaderItemRender": "setup-const",
27
28
  "props": "setup-reactive-const",
28
29
  "tableTool": "setup-maybe-ref",
29
30
  "searchData": "setup-reactive-const",
30
31
  "showFilter": "setup-const",
31
32
  "sortClick": "setup-const"
32
33
  } */
33
- import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createBlock as _createBlock, unref as _unref, mergeProps as _mergeProps, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle } from "vue";
34
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, unref as _unref, mergeProps as _mergeProps, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle } from "vue";
34
35
  const _hoisted_1 = ["id"];
35
36
  const _hoisted_2 = { class: "table-header-cell-title" };
36
- const _hoisted_3 = {
37
+ const _hoisted_3 = { class: "cell-title-box" };
38
+ const _hoisted_4 = { key: 1 };
39
+ const _hoisted_5 = {
37
40
  key: 0,
38
41
  class: "header-cell-required"
39
42
  };
40
- const _hoisted_4 = {
43
+ const _hoisted_6 = {
41
44
  key: 0,
42
45
  class: "table-header-cell-trigger"
43
46
  };
44
47
  import { SearchModal, Sort } from './components/Search';
45
48
  import { reactive, } from 'vue';
46
49
  import { useTableTool } from "./hooks";
50
+ import HeaderItemRender from './HeaderRender.js';
47
51
  const __sfc_main__ = Object.assign({
48
52
  name: 'JEditTableHeader'
49
53
  }, {
@@ -95,13 +99,21 @@ const __sfc_main__ = Object.assign({
95
99
  class: _normalizeClass({ 'jetlinks-edit-table-header-cell-box': true, 'header-cell-box-tool': !!(item.sort || item.filter) })
96
100
  }, [
97
101
  _createElementVNode("div", _hoisted_2, [
98
- _createElementVNode("span", null, _toDisplayString(item.title), 1 /* TEXT */),
102
+ _createElementVNode("div", _hoisted_3, [
103
+ (item.render)
104
+ ? (_openBlock(), _createBlock(HeaderItemRender, {
105
+ key: 0,
106
+ "render-fn": item.render,
107
+ value: item.title
108
+ }, null, 8 /* PROPS */, ["render-fn", "value"]))
109
+ : (_openBlock(), _createElementBlock("span", _hoisted_4, _toDisplayString(item.title), 1 /* TEXT */))
110
+ ]),
99
111
  (_optionalChain([item, 'access', _ => _.form, 'optionalAccess', _2 => _2.required]))
100
- ? (_openBlock(), _createElementBlock("span", _hoisted_3, "*"))
112
+ ? (_openBlock(), _createElementBlock("span", _hoisted_5, "*"))
101
113
  : _createCommentVNode("v-if", true)
102
114
  ]),
103
115
  (!!(item.sort || item.filter))
104
- ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
116
+ ? (_openBlock(), _createElementBlock("div", _hoisted_6, [
105
117
  (item.filter)
106
118
  ? (_openBlock(), _createBlock(_component_AIcon, {
107
119
  key: 0,
@@ -128,10 +140,9 @@ const __sfc_main__ = Object.assign({
128
140
  ? (_openBlock(), _createBlock(_unref(SearchModal), {
129
141
  key: 0,
130
142
  searchKey: searchData.key,
131
- rowKey: _ctx.rowKey,
132
143
  columns: __props.searchColumns,
133
144
  onClose: _cache[0] || (_cache[0] = $event => (searchData.visible = false))
134
- }, null, 8 /* PROPS */, ["searchKey", "rowKey", "columns"]))
145
+ }, null, 8 /* PROPS */, ["searchKey", "columns"]))
135
146
  : _createCommentVNode("v-if", true)
136
147
  ], 4 /* STYLE */));
137
148
  };
@@ -0,0 +1,12 @@
1
+ /* Analyzed bindings: {} */
2
+ import { defineComponent } from 'vue';
3
+ const __sfc_main__ = defineComponent({
4
+ name: "HeaderItemRender",
5
+ props: ['renderFn', 'value'],
6
+ setup(props) {
7
+ return () => {
8
+ return props.renderFn(props.value);
9
+ };
10
+ }
11
+ });
12
+ export default __sfc_main__;
@@ -23,7 +23,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
23
23
  "useTableTool": "setup-maybe-ref",
24
24
  "useGroupOptions": "setup-maybe-ref",
25
25
  "ref": "setup-const",
26
- "reactive": "setup-const",
26
+ "computed": "setup-const",
27
27
  "defineOptions": "setup-const",
28
28
  "Ellipsis": "setup-const",
29
29
  "DragModal": "setup-const",
@@ -47,7 +47,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
47
47
  "tableHeight": "setup-ref",
48
48
  "selectedRowKeys": "setup-ref",
49
49
  "tableRef": "setup-ref",
50
- "myColumns": "setup-reactive-const",
50
+ "myColumns": "setup-ref",
51
51
  "selectedTableRow": "setup-const",
52
52
  "handleFilterArray": "setup-const",
53
53
  "search": "setup-const",
@@ -68,7 +68,7 @@ const _hoisted_6 = { key: 1 };
68
68
  const _hoisted_7 = { class: "jetlinks-table-search-result-total" };
69
69
  import Table from '../../EditTable.js';
70
70
  import { useTableDataSource, useTableOpenGroup, useTableTool, useGroupOptions } from "../../context";
71
- import { ref, reactive, } from "vue";
71
+ import { ref, computed, } from "vue";
72
72
  import Ellipsis from '../../../Ellipsis/Ellipsis.js';
73
73
  import DragModal from '../../../DragModal/DragModal.js';
74
74
  import { useLocaleReceiver } from "../../../LocaleReciver/index";
@@ -103,16 +103,24 @@ const __sfc_main__ = Object.assign({
103
103
  const tableHeight = ref(230);
104
104
  const selectedRowKeys = ref([]);
105
105
  const tableRef = ref();
106
- const myColumns = reactive([
107
- {
108
- title: contextLocale.value.columns.sign,
109
- dataIndex: 'id',
110
- },
111
- {
112
- title: contextLocale.value.columns.name,
113
- dataIndex: 'name',
106
+ const myColumns = computed(() => {
107
+ if (props.columns) {
108
+ return props.columns.map(item => ({
109
+ title: item.title,
110
+ dataIndex: item.dataIndex
111
+ }));
114
112
  }
115
- ]);
113
+ return [
114
+ {
115
+ title: contextLocale.value.columns.sign,
116
+ dataIndex: 'id',
117
+ },
118
+ {
119
+ title: contextLocale.value.columns.name,
120
+ dataIndex: 'name',
121
+ }
122
+ ];
123
+ });
116
124
  const selectedTableRow = (record) => {
117
125
  tableTool.scrollTo({
118
126
  ...record,
@@ -272,7 +280,7 @@ const __sfc_main__ = Object.assign({
272
280
  ref_key: "tableRef",
273
281
  ref: tableRef,
274
282
  "data-source": filterArray.value,
275
- columns: __props.columns || myColumns,
283
+ columns: myColumns.value,
276
284
  height: tableHeight.value,
277
285
  disableMenu: false,
278
286
  cellHeight: 36,
@@ -42,7 +42,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
42
42
  "onDesc": "setup-const"
43
43
  } */
44
44
  import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
45
- const _withScopeId = n => (_pushScopeId("data-v-1744360876152"), n = n(), _popScopeId(), n);
45
+ const _withScopeId = n => (_pushScopeId("data-v-1744627839975"), n = n(), _popScopeId(), n);
46
46
  const _hoisted_1 = { class: "jetlinks-table-sort-content" };
47
47
  const _hoisted_2 = { class: "jetlinks-table-sort-title" };
48
48
  const _hoisted_3 = { class: "table-sort-body" };
@@ -44,10 +44,6 @@ var bodyProps = exports.bodyProps = function bodyProps() {
44
44
  return [];
45
45
  }
46
46
  },
47
- searchColumns: {
48
- type: Array,
49
- default: undefined
50
- },
51
47
  cellHeight: {
52
48
  type: Number,
53
49
  default: 50
@@ -26,6 +26,11 @@
26
26
  display: flex;
27
27
  align-items: center;
28
28
  font-weight: 600;
29
+ gap: 4px;
30
+
31
+ .cell-title-box {
32
+ flex: 1 1 auto;
33
+ }
29
34
  }
30
35
 
31
36
  .header-cell-required {
@@ -116,6 +116,10 @@
116
116
  display: flex;
117
117
  align-items: center;
118
118
  font-weight: 600;
119
+ gap: 4px;
120
+ }
121
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .table-header-cell-title .cell-title-box {
122
+ flex: 1 1 auto;
119
123
  }
120
124
  .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .header-cell-required {
121
125
  color: #ff4d4f;
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.isFullScreen = exports.handlePureRecord = exports.handleColumnsWidth = exports.collectValidateRules = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
7
  var _lodashEs = require("lodash");
10
8
  /**
11
9
  * 规则收集器,收集columns中的rules和watch
@@ -30,7 +28,8 @@ var handlePureRecord = exports.handlePureRecord = function handlePureRecord(reco
30
28
  return (0, _lodashEs.omit)(record, ['__serial', '__index', '__top', '__selected', '__key', '__dataIndex']);
31
29
  };
32
30
  var handleColumnsWidth = exports.handleColumnsWidth = function handleColumnsWidth(columns, warpWidth) {
33
- var newColumns = (0, _toConsumableArray2.default)(columns);
31
+ // let newColumns = [...columns]
32
+ var newColumns = (0, _lodashEs.cloneDeep)(columns);
34
33
  var noWidthLen = 0; // 没有width属性的长度
35
34
  var hasWidthCount = 0; // 有width属性的合计
36
35
  var average = 0; // 每个column宽度
@@ -9,7 +9,7 @@
9
9
  } */
10
10
  import { defineComponent as _defineComponent } from 'vue';
11
11
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
12
- const _withScopeId = n => (_pushScopeId("data-v-1744360873455"), n = n(), _popScopeId(), n);
12
+ const _withScopeId = n => (_pushScopeId("data-v-1744627832852"), n = n(), _popScopeId(), n);
13
13
  const _hoisted_1 = { class: "full-page-warp-content" };
14
14
  import { ref, inject } from 'vue';
15
15
  import { useElementBounding } from '@vueuse/core';
@@ -62,8 +62,7 @@ var PermissionButton = (0, _vue.defineComponent)({
62
62
  components: undefined
63
63
  });
64
64
  var permission = (0, _vue.computed)(function () {
65
- var hasOwnPrototype = Object.prototype.hasOwnProperty.call(instance.props, 'hasPermission');
66
- if (props.hasPermission === true || !hasOwnPrototype) {
65
+ if (props.hasPermission === true || props.hasPermission === undefined) {
67
66
  return true;
68
67
  }
69
68
  return hasPerm.value;
@@ -23,7 +23,7 @@
23
23
  } */
24
24
  import { defineComponent as _defineComponent } from 'vue';
25
25
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
26
- const _withScopeId = n => (_pushScopeId("data-v-1744360875938"), n = n(), _popScopeId(), n);
26
+ const _withScopeId = n => (_pushScopeId("data-v-1744627839173"), n = n(), _popScopeId(), n);
27
27
  const _hoisted_1 = {
28
28
  key: 0,
29
29
  style: { "width": "240px" }
@@ -80,7 +80,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
80
80
  } */
81
81
  import { defineComponent as _defineComponent } from 'vue';
82
82
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
83
- const _withScopeId = n => (_pushScopeId("data-v-1744360874926"), n = n(), _popScopeId(), n);
83
+ const _withScopeId = n => (_pushScopeId("data-v-1744627835796"), n = n(), _popScopeId(), n);
84
84
  const _hoisted_1 = { class: "JSearch-item" };
85
85
  const _hoisted_2 = {
86
86
  key: 0,
@@ -4940,6 +4940,10 @@ span.ant-radio + * {
4940
4940
  display: flex;
4941
4941
  align-items: center;
4942
4942
  font-weight: 600;
4943
+ gap: 4px;
4944
+ }
4945
+ .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .table-header-cell-title .cell-title-box {
4946
+ flex: 1 1 auto;
4943
4947
  }
4944
4948
  .jetlinks-edit-table-header-container .jetlinks-edit-table-header-cell .jetlinks-edit-table-header-cell-box .header-cell-required {
4945
4949
  color: #ff4d4f;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "2.6.8",
3
+ "version": "2.6.10",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -158,9 +158,9 @@
158
158
  "webpack-dev-server": "^4.0.0",
159
159
  "webpack-merge": "^5.0.0",
160
160
  "webpackbar": "^5.0.2",
161
- "@jetlinks-web/utils": "^1.2.8",
161
+ "@jetlinks-web/constants": "^1.0.9",
162
162
  "@jetlinks-web/hooks": "^1.0.25",
163
- "@jetlinks-web/constants": "^1.0.9"
163
+ "@jetlinks-web/utils": "^1.2.9"
164
164
  },
165
165
  "publishConfig": {
166
166
  "registry": "https://registry.npmjs.org/",