@jetlinks-web/components 2.6.26 → 2.6.28

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.
@@ -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-1754881793015"), n = n(), _popScopeId(), n);
45
+ const _withScopeId = n => (_pushScopeId("data-v-1755154724514"), 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" };
@@ -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-1754881791154"), n = n(), _popScopeId(), n);
12
+ const _withScopeId = n => (_pushScopeId("data-v-1755154722160"), 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';
@@ -23,22 +23,36 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
23
23
  "get": "setup-maybe-ref",
24
24
  "omit": "setup-maybe-ref",
25
25
  "Empty": "setup-maybe-ref",
26
+ "useTableInject": "setup-maybe-ref",
27
+ "useLocaleReceiver": "setup-maybe-ref",
26
28
  "props": "setup-reactive-const",
27
29
  "slots": "setup-maybe-ref",
30
+ "contextLocale": "setup-maybe-ref",
31
+ "_rowSelection": "setup-maybe-ref",
28
32
  "_columns": "setup-ref",
29
33
  "_slots": "setup-ref",
30
34
  "_scroll": "setup-ref",
31
- "gridTemplateColumns": "setup-ref"
35
+ "gridTemplateColumns": "setup-ref",
36
+ "__rowSelection": "setup-ref",
37
+ "indeterminate": "setup-ref",
38
+ "checkedAll": "setup-ref",
39
+ "onClick": "setup-const",
40
+ "handleCheckedAllChange": "setup-const"
32
41
  } */
33
42
  import { defineComponent as _defineComponent } from 'vue';
34
- import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createCommentVNode as _createCommentVNode, unref as _unref, createVNode as _createVNode, mergeProps as _mergeProps, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createSlots as _createSlots, createBlock as _createBlock } from "vue";
43
+ import { unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, createSlots as _createSlots, createBlock as _createBlock } from "vue";
35
44
  const _hoisted_1 = { class: "jtable-box" };
36
45
  const _hoisted_2 = {
37
46
  key: 0,
38
47
  class: "jtable-card"
39
48
  };
40
49
  const _hoisted_3 = {
41
- key: 1,
50
+ key: 0,
51
+ style: { "margin-bottom": "10px" }
52
+ };
53
+ const _hoisted_4 = ["onClick"];
54
+ const _hoisted_5 = {
55
+ key: 2,
42
56
  class: "j-table-empty"
43
57
  };
44
58
  import { useSlots, computed } from 'vue';
@@ -46,6 +60,8 @@ import { _contentProps } from "./setting";
46
60
  import { Table } from 'ant-design-vue/es/';
47
61
  import { get, omit } from 'lodash-es';
48
62
  import Empty from '../Empty';
63
+ import { useTableInject } from './hooks';
64
+ import { useLocaleReceiver } from "../LocaleReciver";
49
65
  const __sfc_main__ = _defineComponent({
50
66
  ...{
51
67
  name: 'Content'
@@ -60,6 +76,8 @@ const __sfc_main__ = _defineComponent({
60
76
  setup(__props) {
61
77
  const props = __props;
62
78
  const slots = useSlots();
79
+ const [contextLocale] = useLocaleReceiver('ProTable');
80
+ const _rowSelection = useTableInject();
63
81
  const _columns = computed(() => props.columns.filter((i) => !_optionalChain([i, 'optionalAccess', _2 => _2.hideInTable])));
64
82
  const _slots = computed(() => {
65
83
  return omit(slots, ['emptyText', 'bodyCell']);
@@ -79,47 +97,82 @@ const __sfc_main__ = _defineComponent({
79
97
  const gridTemplateColumns = computed(() => {
80
98
  return `repeat(${props.column}, 1fr)`;
81
99
  });
100
+ const __rowSelection = computed(() => {
101
+ return props.rowSelection || _optionalChain([_rowSelection, 'optionalAccess', _3 => _3.value]);
102
+ });
103
+ const indeterminate = computed(() => {
104
+ return _optionalChain([__rowSelection, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.selectedRowKeys, 'optionalAccess', _6 => _6.length]) > 0 && _optionalChain([__rowSelection, 'access', _7 => _7.value, 'optionalAccess', _8 => _8.selectedRowKeys, 'optionalAccess', _9 => _9.length]) < props.dataSource.length;
105
+ });
106
+ const checkedAll = computed(() => {
107
+ return _optionalChain([__rowSelection, 'access', _10 => _10.value, 'optionalAccess', _11 => _11.selectedRowKeys, 'optionalAccess', _12 => _12.length]) > 0 && _optionalChain([__rowSelection, 'access', _13 => _13.value, 'optionalAccess', _14 => _14.selectedRowKeys, 'optionalAccess', _15 => _15.length]) === props.dataSource.length;
108
+ });
109
+ const onClick = (item) => {
110
+ if (_rowSelection && _rowSelection.value) {
111
+ const _selected = _optionalChain([_rowSelection, 'access', _16 => _16.value, 'access', _17 => _17.selectedRowKeys, 'optionalAccess', _18 => _18.includes, 'call', _19 => _19(item[props.rowKey])]);
112
+ _optionalChain([_rowSelection, 'access', _20 => _20.value, 'access', _21 => _21.onSelect, 'optionalCall', _22 => _22(item, !_selected)]);
113
+ }
114
+ };
115
+ const handleCheckedAllChange = (e) => {
116
+ const flag = e.target.checked;
117
+ _optionalChain([__rowSelection, 'access', _23 => _23.value, 'optionalAccess', _24 => _24.onSelectAll, 'optionalCall', _25 => _25(flag, props.dataSource, props.dataSource)]);
118
+ };
82
119
  return (_ctx, _cache) => {
120
+ const _component_a_checkbox = _resolveComponent("a-checkbox");
83
121
  return (_openBlock(), _createElementBlock("div", _hoisted_1, [
84
122
  (_ctx.mode === 'CARD')
85
123
  ? (_openBlock(), _createElementBlock("div", _hoisted_2, [
124
+ (__rowSelection.value && __rowSelection.value.type === 'checkbox')
125
+ ? (_openBlock(), _createElementBlock("div", _hoisted_3, [
126
+ _createVNode(_component_a_checkbox, {
127
+ indeterminate: indeterminate.value,
128
+ checked: checkedAll.value,
129
+ onChange: handleCheckedAllChange
130
+ }, {
131
+ default: _withCtx(() => [
132
+ _createTextVNode(_toDisplayString(_unref(contextLocale).select.all), 1 /* TEXT */)
133
+ ]),
134
+ _: 1 /* STABLE */
135
+ }, 8 /* PROPS */, ["indeterminate", "checked"])
136
+ ]))
137
+ : _createCommentVNode("v-if", true),
86
138
  (_ctx.dataSource.length)
87
139
  ? (_openBlock(), _createElementBlock("div", {
88
- key: 0,
140
+ key: 1,
89
141
  class: "jtable-card-items",
90
142
  style: _normalizeStyle({ gridTemplateColumns: gridTemplateColumns.value })
91
143
  }, [
92
144
  (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.dataSource, (item) => {
93
145
  return (_openBlock(), _createElementBlock("div", {
94
146
  class: _normalizeClass(['jtable-card-item', props.cardBodyClass]),
95
- key: item[props.rowKey]
147
+ key: item[props.rowKey],
148
+ onClick: ($event) => (onClick(item))
96
149
  }, [
97
150
  _renderSlot(_ctx.$slots, "card", _normalizeProps(_guardReactiveProps(item)))
98
- ], 2 /* CLASS */));
151
+ ], 10 /* CLASS, PROPS */, _hoisted_4));
99
152
  }), 128 /* KEYED_FRAGMENT */))
100
153
  ], 4 /* STYLE */))
101
- : (_openBlock(), _createElementBlock("div", _hoisted_3, [
154
+ : (_openBlock(), _createElementBlock("div", _hoisted_5, [
102
155
  _renderSlot(_ctx.$slots, "emptyText", {}, () => [
103
156
  _createVNode(_unref(Empty))
104
157
  ])
105
158
  ]))
106
159
  ]))
107
160
  : (_openBlock(), _createBlock(_unref(Table), _mergeProps({ key: 1 }, props, {
108
- "row-selection": _ctx.rowSelection,
161
+ "row-selection": __rowSelection.value,
109
162
  dataSource: _ctx.dataSource,
110
163
  columns: _columns.value,
111
164
  pagination: false,
112
165
  scroll: _scroll.value,
113
- class: { 'j-table-scroll': !_optionalChain([props, 'access', _3 => _3.scroll, 'optionalAccess', _4 => _4.y]) }
166
+ class: { 'j-table-scroll': !_optionalChain([props, 'access', _26 => _26.scroll, 'optionalAccess', _27 => _27.y]) }
114
167
  }), _createSlots({
115
168
  bodyCell: _withCtx(({ column, record, index }) => [
116
- ((_optionalChain([column, 'optionalAccess', _5 => _5.key]) || _optionalChain([column, 'optionalAccess', _6 => _6.dataIndex])) && _optionalChain([column, 'optionalAccess', _7 => _7.scopedSlots]) && (_optionalChain([_slots, 'access', _8 => _8.value, 'optionalAccess', _9 => _9[_optionalChain([column, 'optionalAccess', _10 => _10.dataIndex])]]) || _optionalChain([_slots, 'access', _11 => _11.value, 'optionalAccess', _12 => _12[_optionalChain([column, 'optionalAccess', _13 => _13.key])]])))
117
- ? _renderSlot(_ctx.$slots, _optionalChain([column, 'optionalAccess', _14 => _14.key]) || _optionalChain([column, 'optionalAccess', _15 => _15.dataIndex]), _mergeProps({ key: 0 }, record, {
169
+ ((_optionalChain([column, 'optionalAccess', _28 => _28.key]) || _optionalChain([column, 'optionalAccess', _29 => _29.dataIndex])) && _optionalChain([column, 'optionalAccess', _30 => _30.scopedSlots]) && (_optionalChain([_slots, 'access', _31 => _31.value, 'optionalAccess', _32 => _32[_optionalChain([column, 'optionalAccess', _33 => _33.dataIndex])]]) || _optionalChain([_slots, 'access', _34 => _34.value, 'optionalAccess', _35 => _35[_optionalChain([column, 'optionalAccess', _36 => _36.key])]])))
170
+ ? _renderSlot(_ctx.$slots, _optionalChain([column, 'optionalAccess', _37 => _37.key]) || _optionalChain([column, 'optionalAccess', _38 => _38.dataIndex]), _mergeProps({ key: 0 }, record, {
118
171
  index: index,
119
172
  column: column
120
173
  }))
121
174
  : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
122
- _createTextVNode(_toDisplayString(_unref(get)(record, _optionalChain([column, 'optionalAccess', _16 => _16.dataIndex]) || _optionalChain([column, 'optionalAccess', _17 => _17.key])) || '--'), 1 /* TEXT */)
175
+ _createTextVNode(_toDisplayString(_unref(get)(record, _optionalChain([column, 'optionalAccess', _39 => _39.dataIndex]) || _optionalChain([column, 'optionalAccess', _40 => _40.key])) || '--'), 1 /* TEXT */)
123
176
  ], 64 /* STABLE_FRAGMENT */))
124
177
  ]),
125
178
  emptyText: _withCtx(() => [
@@ -133,7 +186,7 @@ const __sfc_main__ = _defineComponent({
133
186
  return {
134
187
  name: slotKey,
135
188
  fn: _withCtx((slotProps) => [
136
- (!((_optionalChain([__props, 'access', _18 => _18.column, 'optionalAccess', _19 => _19.key]) || _optionalChain([__props, 'access', _20 => _20.column, 'optionalAccess', _21 => _21.dataIndex])) && _optionalChain([__props, 'access', _22 => _22.column, 'optionalAccess', _23 => _23.scopedSlots]) && (_optionalChain([_slots, 'access', _24 => _24.value, 'optionalAccess', _25 => _25[_optionalChain([__props, 'access', _26 => _26.column, 'optionalAccess', _27 => _27.dataIndex])]]) || _optionalChain([_slots, 'access', _28 => _28.value, 'optionalAccess', _29 => _29[_optionalChain([__props, 'access', _30 => _30.column, 'optionalAccess', _31 => _31.key])]]))))
189
+ (!((_optionalChain([__props, 'access', _41 => _41.column, 'optionalAccess', _42 => _42.key]) || _optionalChain([__props, 'access', _43 => _43.column, 'optionalAccess', _44 => _44.dataIndex])) && _optionalChain([__props, 'access', _45 => _45.column, 'optionalAccess', _46 => _46.scopedSlots]) && (_optionalChain([_slots, 'access', _47 => _47.value, 'optionalAccess', _48 => _48[_optionalChain([__props, 'access', _49 => _49.column, 'optionalAccess', _50 => _50.dataIndex])]]) || _optionalChain([_slots, 'access', _51 => _51.value, 'optionalAccess', _52 => _52[_optionalChain([__props, 'access', _53 => _53.column, 'optionalAccess', _54 => _54.key])]]))))
137
190
  ? _renderSlot(_ctx.$slots, slotKey, _normalizeProps(_mergeProps({ key: 0 }, slotProps)))
138
191
  : _createCommentVNode("v-if", true)
139
192
  ])
@@ -0,0 +1,2 @@
1
+ export * from './useTableSelection';
2
+ export * from './useTableInject';
@@ -71,9 +71,12 @@
71
71
 
72
72
  .jtable-card {
73
73
  height: 100%;
74
- overflow-y: auto;
74
+ display: flex;
75
+ flex-direction: column;
75
76
 
76
77
  .jtable-card-items {
78
+ height: 100%;
79
+ overflow-y: auto;
77
80
  display: grid;
78
81
  grid-gap: 26px;
79
82
 
@@ -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-1754881792772"), n = n(), _popScopeId(), n);
26
+ const _withScopeId = n => (_pushScopeId("data-v-1755154724391"), 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-1754881791931"), n = n(), _popScopeId(), n);
83
+ const _withScopeId = n => (_pushScopeId("data-v-1755154723815"), n = n(), _popScopeId(), n);
84
84
  const _hoisted_1 = { class: "JSearch-item" };
85
85
  const _hoisted_2 = {
86
86
  key: 0,
@@ -51,6 +51,9 @@ export default {
51
51
  alert: {
52
52
  cancelChoose: 'Cancel selection',
53
53
  selectItem: 'Select {0} items'
54
+ },
55
+ select: {
56
+ all: 'Select all'
54
57
  }
55
58
  },
56
59
  ProLayout: {
@@ -51,6 +51,9 @@ export default {
51
51
  alert: {
52
52
  cancelChoose: '取消选择',
53
53
  selectItem: '已选择 {0} 项'
54
+ },
55
+ select: {
56
+ all: '全选'
54
57
  }
55
58
  },
56
59
  ProLayout: {
@@ -4512,9 +4512,12 @@ span.ant-radio + * {
4512
4512
  }
4513
4513
  .jtable-box .jtable-card {
4514
4514
  height: 100%;
4515
- overflow-y: auto;
4515
+ display: flex;
4516
+ flex-direction: column;
4516
4517
  }
4517
4518
  .jtable-box .jtable-card .jtable-card-items {
4519
+ height: 100%;
4520
+ overflow-y: auto;
4518
4521
  display: grid;
4519
4522
  grid-gap: 26px;
4520
4523
  }
@@ -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-1754881792996"), n = n(), _popScopeId(), n);
45
+ const _withScopeId = n => (_pushScopeId("data-v-1755154724497"), 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" };
@@ -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-1754881791146"), n = n(), _popScopeId(), n);
12
+ const _withScopeId = n => (_pushScopeId("data-v-1755154721895"), 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';
@@ -23,22 +23,36 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
23
23
  "get": "setup-maybe-ref",
24
24
  "omit": "setup-maybe-ref",
25
25
  "Empty": "setup-maybe-ref",
26
+ "useTableInject": "setup-maybe-ref",
27
+ "useLocaleReceiver": "setup-maybe-ref",
26
28
  "props": "setup-reactive-const",
27
29
  "slots": "setup-maybe-ref",
30
+ "contextLocale": "setup-maybe-ref",
31
+ "_rowSelection": "setup-maybe-ref",
28
32
  "_columns": "setup-ref",
29
33
  "_slots": "setup-ref",
30
34
  "_scroll": "setup-ref",
31
- "gridTemplateColumns": "setup-ref"
35
+ "gridTemplateColumns": "setup-ref",
36
+ "__rowSelection": "setup-ref",
37
+ "indeterminate": "setup-ref",
38
+ "checkedAll": "setup-ref",
39
+ "onClick": "setup-const",
40
+ "handleCheckedAllChange": "setup-const"
32
41
  } */
33
42
  import { defineComponent as _defineComponent } from 'vue';
34
- import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createCommentVNode as _createCommentVNode, unref as _unref, createVNode as _createVNode, mergeProps as _mergeProps, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createSlots as _createSlots, createBlock as _createBlock } from "vue";
43
+ import { unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, createSlots as _createSlots, createBlock as _createBlock } from "vue";
35
44
  const _hoisted_1 = { class: "jtable-box" };
36
45
  const _hoisted_2 = {
37
46
  key: 0,
38
47
  class: "jtable-card"
39
48
  };
40
49
  const _hoisted_3 = {
41
- key: 1,
50
+ key: 0,
51
+ style: { "margin-bottom": "10px" }
52
+ };
53
+ const _hoisted_4 = ["onClick"];
54
+ const _hoisted_5 = {
55
+ key: 2,
42
56
  class: "j-table-empty"
43
57
  };
44
58
  import { useSlots, computed } from 'vue';
@@ -46,6 +60,8 @@ import { _contentProps } from "./setting";
46
60
  import { Table } from 'ant-design-vue/lib/';
47
61
  import { get, omit } from 'lodash-es';
48
62
  import Empty from '../Empty';
63
+ import { useTableInject } from './hooks';
64
+ import { useLocaleReceiver } from "../LocaleReciver";
49
65
  const __sfc_main__ = _defineComponent({
50
66
  ...{
51
67
  name: 'Content'
@@ -60,6 +76,8 @@ const __sfc_main__ = _defineComponent({
60
76
  setup(__props) {
61
77
  const props = __props;
62
78
  const slots = useSlots();
79
+ const [contextLocale] = useLocaleReceiver('ProTable');
80
+ const _rowSelection = useTableInject();
63
81
  const _columns = computed(() => props.columns.filter((i) => !_optionalChain([i, 'optionalAccess', _2 => _2.hideInTable])));
64
82
  const _slots = computed(() => {
65
83
  return omit(slots, ['emptyText', 'bodyCell']);
@@ -79,47 +97,82 @@ const __sfc_main__ = _defineComponent({
79
97
  const gridTemplateColumns = computed(() => {
80
98
  return `repeat(${props.column}, 1fr)`;
81
99
  });
100
+ const __rowSelection = computed(() => {
101
+ return props.rowSelection || _optionalChain([_rowSelection, 'optionalAccess', _3 => _3.value]);
102
+ });
103
+ const indeterminate = computed(() => {
104
+ return _optionalChain([__rowSelection, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.selectedRowKeys, 'optionalAccess', _6 => _6.length]) > 0 && _optionalChain([__rowSelection, 'access', _7 => _7.value, 'optionalAccess', _8 => _8.selectedRowKeys, 'optionalAccess', _9 => _9.length]) < props.dataSource.length;
105
+ });
106
+ const checkedAll = computed(() => {
107
+ return _optionalChain([__rowSelection, 'access', _10 => _10.value, 'optionalAccess', _11 => _11.selectedRowKeys, 'optionalAccess', _12 => _12.length]) > 0 && _optionalChain([__rowSelection, 'access', _13 => _13.value, 'optionalAccess', _14 => _14.selectedRowKeys, 'optionalAccess', _15 => _15.length]) === props.dataSource.length;
108
+ });
109
+ const onClick = (item) => {
110
+ if (_rowSelection && _rowSelection.value) {
111
+ const _selected = _optionalChain([_rowSelection, 'access', _16 => _16.value, 'access', _17 => _17.selectedRowKeys, 'optionalAccess', _18 => _18.includes, 'call', _19 => _19(item[props.rowKey])]);
112
+ _optionalChain([_rowSelection, 'access', _20 => _20.value, 'access', _21 => _21.onSelect, 'optionalCall', _22 => _22(item, !_selected)]);
113
+ }
114
+ };
115
+ const handleCheckedAllChange = (e) => {
116
+ const flag = e.target.checked;
117
+ _optionalChain([__rowSelection, 'access', _23 => _23.value, 'optionalAccess', _24 => _24.onSelectAll, 'optionalCall', _25 => _25(flag, props.dataSource, props.dataSource)]);
118
+ };
82
119
  return (_ctx, _cache) => {
120
+ const _component_a_checkbox = _resolveComponent("a-checkbox");
83
121
  return (_openBlock(), _createElementBlock("div", _hoisted_1, [
84
122
  (_ctx.mode === 'CARD')
85
123
  ? (_openBlock(), _createElementBlock("div", _hoisted_2, [
124
+ (__rowSelection.value && __rowSelection.value.type === 'checkbox')
125
+ ? (_openBlock(), _createElementBlock("div", _hoisted_3, [
126
+ _createVNode(_component_a_checkbox, {
127
+ indeterminate: indeterminate.value,
128
+ checked: checkedAll.value,
129
+ onChange: handleCheckedAllChange
130
+ }, {
131
+ default: _withCtx(() => [
132
+ _createTextVNode(_toDisplayString(_unref(contextLocale).select.all), 1 /* TEXT */)
133
+ ]),
134
+ _: 1 /* STABLE */
135
+ }, 8 /* PROPS */, ["indeterminate", "checked"])
136
+ ]))
137
+ : _createCommentVNode("v-if", true),
86
138
  (_ctx.dataSource.length)
87
139
  ? (_openBlock(), _createElementBlock("div", {
88
- key: 0,
140
+ key: 1,
89
141
  class: "jtable-card-items",
90
142
  style: _normalizeStyle({ gridTemplateColumns: gridTemplateColumns.value })
91
143
  }, [
92
144
  (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.dataSource, (item) => {
93
145
  return (_openBlock(), _createElementBlock("div", {
94
146
  class: _normalizeClass(['jtable-card-item', props.cardBodyClass]),
95
- key: item[props.rowKey]
147
+ key: item[props.rowKey],
148
+ onClick: ($event) => (onClick(item))
96
149
  }, [
97
150
  _renderSlot(_ctx.$slots, "card", _normalizeProps(_guardReactiveProps(item)))
98
- ], 2 /* CLASS */));
151
+ ], 10 /* CLASS, PROPS */, _hoisted_4));
99
152
  }), 128 /* KEYED_FRAGMENT */))
100
153
  ], 4 /* STYLE */))
101
- : (_openBlock(), _createElementBlock("div", _hoisted_3, [
154
+ : (_openBlock(), _createElementBlock("div", _hoisted_5, [
102
155
  _renderSlot(_ctx.$slots, "emptyText", {}, () => [
103
156
  _createVNode(_unref(Empty))
104
157
  ])
105
158
  ]))
106
159
  ]))
107
160
  : (_openBlock(), _createBlock(_unref(Table), _mergeProps({ key: 1 }, props, {
108
- "row-selection": _ctx.rowSelection,
161
+ "row-selection": __rowSelection.value,
109
162
  dataSource: _ctx.dataSource,
110
163
  columns: _columns.value,
111
164
  pagination: false,
112
165
  scroll: _scroll.value,
113
- class: { 'j-table-scroll': !_optionalChain([props, 'access', _3 => _3.scroll, 'optionalAccess', _4 => _4.y]) }
166
+ class: { 'j-table-scroll': !_optionalChain([props, 'access', _26 => _26.scroll, 'optionalAccess', _27 => _27.y]) }
114
167
  }), _createSlots({
115
168
  bodyCell: _withCtx(({ column, record, index }) => [
116
- ((_optionalChain([column, 'optionalAccess', _5 => _5.key]) || _optionalChain([column, 'optionalAccess', _6 => _6.dataIndex])) && _optionalChain([column, 'optionalAccess', _7 => _7.scopedSlots]) && (_optionalChain([_slots, 'access', _8 => _8.value, 'optionalAccess', _9 => _9[_optionalChain([column, 'optionalAccess', _10 => _10.dataIndex])]]) || _optionalChain([_slots, 'access', _11 => _11.value, 'optionalAccess', _12 => _12[_optionalChain([column, 'optionalAccess', _13 => _13.key])]])))
117
- ? _renderSlot(_ctx.$slots, _optionalChain([column, 'optionalAccess', _14 => _14.key]) || _optionalChain([column, 'optionalAccess', _15 => _15.dataIndex]), _mergeProps({ key: 0 }, record, {
169
+ ((_optionalChain([column, 'optionalAccess', _28 => _28.key]) || _optionalChain([column, 'optionalAccess', _29 => _29.dataIndex])) && _optionalChain([column, 'optionalAccess', _30 => _30.scopedSlots]) && (_optionalChain([_slots, 'access', _31 => _31.value, 'optionalAccess', _32 => _32[_optionalChain([column, 'optionalAccess', _33 => _33.dataIndex])]]) || _optionalChain([_slots, 'access', _34 => _34.value, 'optionalAccess', _35 => _35[_optionalChain([column, 'optionalAccess', _36 => _36.key])]])))
170
+ ? _renderSlot(_ctx.$slots, _optionalChain([column, 'optionalAccess', _37 => _37.key]) || _optionalChain([column, 'optionalAccess', _38 => _38.dataIndex]), _mergeProps({ key: 0 }, record, {
118
171
  index: index,
119
172
  column: column
120
173
  }))
121
174
  : (_openBlock(), _createElementBlock(_Fragment, { key: 1 }, [
122
- _createTextVNode(_toDisplayString(_unref(get)(record, _optionalChain([column, 'optionalAccess', _16 => _16.dataIndex]) || _optionalChain([column, 'optionalAccess', _17 => _17.key])) || '--'), 1 /* TEXT */)
175
+ _createTextVNode(_toDisplayString(_unref(get)(record, _optionalChain([column, 'optionalAccess', _39 => _39.dataIndex]) || _optionalChain([column, 'optionalAccess', _40 => _40.key])) || '--'), 1 /* TEXT */)
123
176
  ], 64 /* STABLE_FRAGMENT */))
124
177
  ]),
125
178
  emptyText: _withCtx(() => [
@@ -133,7 +186,7 @@ const __sfc_main__ = _defineComponent({
133
186
  return {
134
187
  name: slotKey,
135
188
  fn: _withCtx((slotProps) => [
136
- (!((_optionalChain([__props, 'access', _18 => _18.column, 'optionalAccess', _19 => _19.key]) || _optionalChain([__props, 'access', _20 => _20.column, 'optionalAccess', _21 => _21.dataIndex])) && _optionalChain([__props, 'access', _22 => _22.column, 'optionalAccess', _23 => _23.scopedSlots]) && (_optionalChain([_slots, 'access', _24 => _24.value, 'optionalAccess', _25 => _25[_optionalChain([__props, 'access', _26 => _26.column, 'optionalAccess', _27 => _27.dataIndex])]]) || _optionalChain([_slots, 'access', _28 => _28.value, 'optionalAccess', _29 => _29[_optionalChain([__props, 'access', _30 => _30.column, 'optionalAccess', _31 => _31.key])]]))))
189
+ (!((_optionalChain([__props, 'access', _41 => _41.column, 'optionalAccess', _42 => _42.key]) || _optionalChain([__props, 'access', _43 => _43.column, 'optionalAccess', _44 => _44.dataIndex])) && _optionalChain([__props, 'access', _45 => _45.column, 'optionalAccess', _46 => _46.scopedSlots]) && (_optionalChain([_slots, 'access', _47 => _47.value, 'optionalAccess', _48 => _48[_optionalChain([__props, 'access', _49 => _49.column, 'optionalAccess', _50 => _50.dataIndex])]]) || _optionalChain([_slots, 'access', _51 => _51.value, 'optionalAccess', _52 => _52[_optionalChain([__props, 'access', _53 => _53.column, 'optionalAccess', _54 => _54.key])]]))))
137
190
  ? _renderSlot(_ctx.$slots, slotKey, _normalizeProps(_mergeProps({ key: 0 }, slotProps)))
138
191
  : _createCommentVNode("v-if", true)
139
192
  ])
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useTableSelection = require("./useTableSelection");
7
+ Object.keys(_useTableSelection).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useTableSelection[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _useTableSelection[key];
14
+ }
15
+ });
16
+ });
17
+ var _useTableInject = require("./useTableInject");
18
+ Object.keys(_useTableInject).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _useTableInject[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _useTableInject[key];
25
+ }
26
+ });
27
+ });
@@ -71,9 +71,12 @@
71
71
 
72
72
  .jtable-card {
73
73
  height: 100%;
74
- overflow-y: auto;
74
+ display: flex;
75
+ flex-direction: column;
75
76
 
76
77
  .jtable-card-items {
78
+ height: 100%;
79
+ overflow-y: auto;
77
80
  display: grid;
78
81
  grid-gap: 26px;
79
82
 
@@ -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-1754881792757"), n = n(), _popScopeId(), n);
26
+ const _withScopeId = n => (_pushScopeId("data-v-1755154724378"), 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-1754881791856"), n = n(), _popScopeId(), n);
83
+ const _withScopeId = n => (_pushScopeId("data-v-1755154723758"), n = n(), _popScopeId(), n);
84
84
  const _hoisted_1 = { class: "JSearch-item" };
85
85
  const _hoisted_2 = {
86
86
  key: 0,
@@ -57,6 +57,9 @@ var _default = exports.default = {
57
57
  alert: {
58
58
  cancelChoose: 'Cancel selection',
59
59
  selectItem: 'Select {0} items'
60
+ },
61
+ select: {
62
+ all: 'Select all'
60
63
  }
61
64
  },
62
65
  ProLayout: {
@@ -57,6 +57,9 @@ var _default = exports.default = {
57
57
  alert: {
58
58
  cancelChoose: '取消选择',
59
59
  selectItem: '已选择 {0} 项'
60
+ },
61
+ select: {
62
+ all: '全选'
60
63
  }
61
64
  },
62
65
  ProLayout: {
@@ -4512,9 +4512,12 @@ span.ant-radio + * {
4512
4512
  }
4513
4513
  .jtable-box .jtable-card {
4514
4514
  height: 100%;
4515
- overflow-y: auto;
4515
+ display: flex;
4516
+ flex-direction: column;
4516
4517
  }
4517
4518
  .jtable-box .jtable-card .jtable-card-items {
4519
+ height: 100%;
4520
+ overflow-y: auto;
4518
4521
  display: grid;
4519
4522
  grid-gap: 26px;
4520
4523
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "2.6.26",
3
+ "version": "2.6.28",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -46,7 +46,7 @@
46
46
  "sortablejs": "^1.15.2",
47
47
  "@jetlinks-web/constants": "1.0.9",
48
48
  "@jetlinks-web/hooks": "1.0.29",
49
- "@jetlinks-web/utils": "1.2.12"
49
+ "@jetlinks-web/utils": "1.2.13"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@babel/cli": "^7.8.4",