@jetlinks-web/components 3.2.3 → 3.2.5

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.
@@ -16,6 +16,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
16
16
  } return value; }
17
17
  /* Analyzed bindings: {
18
18
  "searchKey": "props",
19
+ "multiple": "props",
19
20
  "Select": "setup-maybe-ref",
20
21
  "selectProps": "setup-maybe-ref",
21
22
  "ref": "setup-const",
@@ -34,10 +35,10 @@ import { defineComponent as _defineComponent } from 'vue';
34
35
  import { unref as _unref, mergeProps as _mergeProps, openBlock as _openBlock, createBlock as _createBlock } from "vue";
35
36
  import { Select } from 'ant-design-vue';
36
37
  import { selectProps } from 'ant-design-vue/lib/select';
37
- import { ref, watch, computed } from 'vue';
38
+ import { ref, watch, computed, } from 'vue';
38
39
  const __sfc_main__ = _defineComponent({
39
40
  ...{
40
- name: 'JAutoComplete'
41
+ name: 'JAutoComplete',
41
42
  },
42
43
  props: {
43
44
  ...selectProps(),
@@ -45,6 +46,10 @@ const __sfc_main__ = _defineComponent({
45
46
  type: String,
46
47
  default: 'label',
47
48
  },
49
+ multiple: {
50
+ type: Boolean,
51
+ default: true,
52
+ },
48
53
  },
49
54
  emits: ["select", "change", "update:value"],
50
55
  setup(__props, { emit: __emit }) {
@@ -59,27 +64,30 @@ const __sfc_main__ = _defineComponent({
59
64
  }
60
65
  };
61
66
  const _options = computed(() => {
62
- const item = props.options.find(option => option.value === myValue.value);
67
+ const item = props.options.find((option) => option.value === myValue.value);
63
68
  if (item || !myValue.value) {
64
69
  _label.value = _optionalChain([item, 'optionalAccess', _ => _.label]);
65
70
  return props.options;
66
71
  }
67
72
  _label.value = myValue.value;
68
- return [
69
- { label: myValue.value, value: myValue.value },
70
- ...props.options
71
- ];
73
+ return [{ label: myValue.value, value: myValue.value }, ...props.options];
72
74
  });
73
75
  const handleSearch = (e) => {
74
76
  myValue.value = e;
75
77
  };
76
78
  const onSelect = (val, option) => {
77
- myValue.value = val;
78
- emit('update:value', val);
79
- emit('select', val, option);
79
+ let _val = val;
80
+ let _option = option;
81
+ if (props.multiple === false) {
82
+ _val = val[0];
83
+ _option = option[0];
84
+ }
85
+ myValue.value = [_val];
86
+ emit('update:value', _val);
87
+ emit('select', _val, _option);
80
88
  };
81
89
  watch(() => props.value, (val) => {
82
- myValue.value = val;
90
+ myValue.value = props.multiple ? [val] : val;
83
91
  }, { immediate: true });
84
92
  return (_ctx, _cache) => {
85
93
  return (_openBlock(), _createBlock(_unref(Select), _mergeProps({
@@ -97,7 +97,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
97
97
  "onScrollDown": "setup-const"
98
98
  } */
99
99
  import { defineComponent as _defineComponent } from 'vue';
100
- import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, mergeProps as _mergeProps, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, normalizeClass as _normalizeClass } from "vue";
100
+ import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, mergeProps as _mergeProps, withCtx as _withCtx, renderList as _renderList, createSlots as _createSlots, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, normalizeClass as _normalizeClass } from "vue";
101
101
  const _hoisted_1 = { class: "jetlinks-edit-table-extra" };
102
102
  const _hoisted_2 = { class: "jetlinks-edit-table" };
103
103
  const _hoisted_3 = { class: "jetlinks-edit-table-body" };
@@ -105,47 +105,54 @@ const _hoisted_4 = {
105
105
  key: 0,
106
106
  class: "readonly-mask"
107
107
  };
108
- import { FULL_SCREEN, RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_GROUP_ACTIVE, TABLE_GROUP_ERROR, TABLE_GROUP_OPTIONS, TABLE_H_SCROLL, TABLE_OPEN_GROUP, TABLE_TOOL, TABLE_WRAPPER } from './consts';
108
+ import { FULL_SCREEN, RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_GROUP_ACTIVE, TABLE_GROUP_ERROR, TABLE_GROUP_OPTIONS, TABLE_H_SCROLL, TABLE_OPEN_GROUP, TABLE_TOOL, TABLE_WRAPPER, } from './consts';
109
109
  import { useGroup, useValidate } from './hooks';
110
110
  import { tableProps } from 'ant-design-vue/lib/table';
111
111
  import { useFormContext } from './context';
112
112
  import { useFullscreen } from '@vueuse/core';
113
113
  import { provide, useSlots, ref, reactive, computed, watch } from 'vue';
114
- import { bodyProps } from "./props";
114
+ import { bodyProps } from './props';
115
115
  import { findIndex, get, sortBy } from 'lodash-es';
116
116
  import Group from './group.js';
117
117
  import VirtualTable from '../VirtualTable/Table';
118
- import { useLocaleReceiver } from "../LocaleReciver";
118
+ import { useLocaleReceiver } from '../LocaleReciver';
119
119
  import useEditTableStyle from './style';
120
120
  const defaultGroupId = 'group_1';
121
121
  const __sfc_main__ = _defineComponent({
122
122
  ...{
123
- name: 'JEditTable'
123
+ name: 'JEditTable',
124
124
  },
125
125
  props: {
126
126
  ...tableProps(),
127
127
  ...bodyProps(),
128
128
  searchColumns: {
129
129
  type: Array,
130
- default: undefined
130
+ default: undefined,
131
131
  },
132
132
  serial: {
133
133
  type: [Object, Boolean],
134
134
  default: () => ({
135
135
  width: 70,
136
- title: ''
137
- })
136
+ title: '',
137
+ }),
138
138
  },
139
139
  validateRowKey: {
140
140
  type: Boolean,
141
- default: false
141
+ default: false,
142
142
  },
143
143
  readonly: {
144
144
  type: Boolean,
145
- default: false
146
- }
145
+ default: false,
146
+ },
147
147
  },
148
- emits: ['scrollDown', 'rightMenuClick', 'editChange', 'searchVisibleChange', 'groupDelete', 'groupEdit'],
148
+ emits: [
149
+ 'scrollDown',
150
+ 'rightMenuClick',
151
+ 'editChange',
152
+ 'searchVisibleChange',
153
+ 'groupDelete',
154
+ 'groupEdit',
155
+ ],
149
156
  setup(__props, { expose: __expose, emit: __emit }) {
150
157
  const emit = __emit;
151
158
  const [contextLocale] = useLocaleReceiver('EditTable');
@@ -165,9 +172,9 @@ const __sfc_main__ = _defineComponent({
165
172
  key: undefined,
166
173
  order: undefined,
167
174
  orderKeys: [],
168
- dataIndex: undefined
175
+ dataIndex: undefined,
169
176
  });
170
- const { groupActive, groupOptions, addGroup, removeGroup, updateGroupActive, updateGroupOptions } = useGroup(props.openGroup);
177
+ const { groupActive, groupOptions, addGroup, removeGroup, updateGroupActive, updateGroupOptions, } = useGroup(props.openGroup);
171
178
  // 处理数据源
172
179
  const _dataSource = computed(() => {
173
180
  const _options = new Map();
@@ -185,7 +192,8 @@ const __sfc_main__ = _defineComponent({
185
192
  const _groupId = _optionalChain([item, 'access', _2 => _2.expands, 'optionalAccess', _3 => _3.groupId]);
186
193
  if (!_groupId) {
187
194
  item.expands.groupId = groupActive.value || defaultGroupId;
188
- item.expands.groupName = groupActive.label || (contextLocale.value.Group.one + '1');
195
+ item.expands.groupName =
196
+ groupActive.label || contextLocale.value.Group.one + '1';
189
197
  }
190
198
  const _optionsItem = _options.get(item.expands.groupId);
191
199
  if (!_optionsItem) {
@@ -193,7 +201,7 @@ const __sfc_main__ = _defineComponent({
193
201
  value: _optionalChain([item, 'access', _4 => _4.expands, 'optionalAccess', _5 => _5.groupId]),
194
202
  label: _optionalChain([item, 'access', _6 => _6.expands, 'optionalAccess', _7 => _7.groupName]),
195
203
  effective: item.id ? 1 : 0,
196
- len: 1
204
+ len: 1,
197
205
  });
198
206
  }
199
207
  else {
@@ -225,7 +233,7 @@ const __sfc_main__ = _defineComponent({
225
233
  });
226
234
  const scroll = computed(() => {
227
235
  const _scroll = {
228
- y: props.height
236
+ y: props.height,
229
237
  };
230
238
  if (_optionalChain([props, 'access', _9 => _9.scroll, 'optionalAccess', _10 => _10.x])) {
231
239
  _scroll.x = props.scroll.x;
@@ -241,7 +249,9 @@ const __sfc_main__ = _defineComponent({
241
249
  err.forEach((item, errIndex) => {
242
250
  item.forEach((e, eIndex) => {
243
251
  const field = findField(e.__dataIndex, e.field);
244
- const _eventKey = field ? field.eventKey : `${e.__dataIndex}-${e.field}`;
252
+ const _eventKey = field
253
+ ? field.eventKey
254
+ : `${e.__dataIndex}-${e.field}`;
245
255
  if (field) {
246
256
  field.showErrorTip(e.message);
247
257
  }
@@ -265,12 +275,15 @@ const __sfc_main__ = _defineComponent({
265
275
  onEdit: () => {
266
276
  emit('editChange', true);
267
277
  },
268
- validateRowKey: props.validateRowKey
278
+ validateRowKey: props.validateRowKey,
269
279
  });
270
280
  // Provide context
271
281
  provide(TABLE_WRAPPER, tableWrapper);
272
282
  provide(FULL_SCREEN, isFullscreen);
273
- provide(RIGHT_MENU, { click: rightMenu, getPopupContainer: () => tableWrapper.value });
283
+ provide(RIGHT_MENU, {
284
+ click: rightMenu,
285
+ getPopupContainer: () => tableWrapper.value,
286
+ });
274
287
  provide(TABLE_ERROR, fieldsErrMap);
275
288
  provide(TABLE_GROUP_ERROR, fieldsGroupError);
276
289
  provide(TABLE_DATA_SOURCE, _dataSource);
@@ -300,7 +313,7 @@ const __sfc_main__ = _defineComponent({
300
313
  sortData.orderKeys = [];
301
314
  sortData.dataIndex = undefined;
302
315
  },
303
- sortData
316
+ sortData,
304
317
  });
305
318
  provide(TABLE_GROUP_OPTIONS, groupOptions);
306
319
  provide(TABLE_GROUP_ACTIVE, groupActive);
@@ -328,7 +341,9 @@ const __sfc_main__ = _defineComponent({
328
341
  fieldsErrMap.value[key] = message;
329
342
  }
330
343
  const scrollWidth = computed(() => {
331
- return (props.dataSource.length * props.cellHeight) > props.height ? scrollDefaultWidth.value : 0;
344
+ return props.dataSource.length * props.cellHeight > props.height
345
+ ? scrollDefaultWidth.value
346
+ : 0;
332
347
  });
333
348
  const newColumns = computed(() => {
334
349
  const _columns = [];
@@ -344,7 +359,7 @@ const __sfc_main__ = _defineComponent({
344
359
  return record.__serial;
345
360
  },
346
361
  width: _optionalChain([(props.serial), 'optionalAccess', _14 => _14.width]),
347
- fixed: 'left'
362
+ fixed: 'left',
348
363
  };
349
364
  _columns.push(serial);
350
365
  }
@@ -369,7 +384,7 @@ const __sfc_main__ = _defineComponent({
369
384
  };
370
385
  const groupDelete = (id, index) => {
371
386
  removeGroup(index);
372
- Object.keys(fieldsErrMap.value).forEach(errorKey => {
387
+ Object.keys(fieldsErrMap.value).forEach((errorKey) => {
373
388
  const [idx] = errorKey.split('-');
374
389
  const dataSourceItem = _dataSource.value[parseInt(idx)];
375
390
  const groupId = _optionalChain([dataSourceItem, 'optionalAccess', _15 => _15.expands, 'optionalAccess', _16 => _16.groupId]);
@@ -396,7 +411,7 @@ const __sfc_main__ = _defineComponent({
396
411
  if (props.openGroup) {
397
412
  const _errorObj = errorMap;
398
413
  const groupErrorMap = {};
399
- Object.keys(_errorObj).forEach(errorKey => {
414
+ Object.keys(_errorObj).forEach((errorKey) => {
400
415
  const [index] = errorKey.split('-');
401
416
  const dataSourceItem = _dataSource.value[parseInt(index)];
402
417
  const groupId = _optionalChain([dataSourceItem, 'optionalAccess', _17 => _17.expands, 'optionalAccess', _18 => _18.groupId]);
@@ -405,8 +420,8 @@ const __sfc_main__ = _defineComponent({
405
420
  [errorKey]: {
406
421
  message: _errorObj[errorKey],
407
422
  index,
408
- serial: dataSourceItem.__serial
409
- }
423
+ serial: dataSourceItem.__serial,
424
+ },
410
425
  };
411
426
  if (groupError) {
412
427
  groupError.push(groupErrorItem);
@@ -426,7 +441,7 @@ const __sfc_main__ = _defineComponent({
426
441
  removeField,
427
442
  removeFieldError,
428
443
  addFieldError,
429
- validateItem
444
+ validateItem,
430
445
  });
431
446
  __expose({
432
447
  validate,
@@ -434,14 +449,14 @@ const __sfc_main__ = _defineComponent({
434
449
  scrollToById,
435
450
  scrollToByIndex,
436
451
  getTableWrapperRef,
437
- getGroupActive
452
+ getGroupActive,
438
453
  });
439
454
  return (_ctx, _cache) => {
440
455
  return (_openBlock(), _createElementBlock("div", {
441
456
  class: _normalizeClass({
442
457
  'jetlinks-edit-table-wrapper': true,
443
458
  'table-full-screen': _unref(isFullscreen),
444
- [_unref(hashId)]: true
459
+ [_unref(hashId)]: true,
445
460
  }),
446
461
  ref_key: "tableWrapper",
447
462
  ref: tableWrapper
@@ -457,7 +472,7 @@ const __sfc_main__ = _defineComponent({
457
472
  _createVNode(_unref(VirtualTable), _mergeProps({
458
473
  ref_key: "virtualTableRef",
459
474
  ref: virtualTableRef
460
- }, props, {
475
+ }, _ctx.$attrs, {
461
476
  "data-source": bodyDataSource.value,
462
477
  columns: newColumns.value,
463
478
  scroll: scroll.value,
@@ -465,19 +480,31 @@ const __sfc_main__ = _defineComponent({
465
480
  virtual: {
466
481
  itemHeight: props.cellHeight,
467
482
  overscan: 5,
468
- threshold: props.height / props.cellHeight
483
+ threshold: props.height / props.cellHeight,
469
484
  }
470
- }), {
485
+ }), _createSlots({
471
486
  bodyCell: _withCtx(({ column, record, index }) => [
472
- _renderSlot(_ctx.$slots, column.dataIndex, {
473
- column: column,
474
- record: record,
475
- index: record.__dataIndex,
476
- visibleIndex: index
477
- })
487
+ (_ctx.$slots[column.dataIndex])
488
+ ? _renderSlot(_ctx.$slots, column.dataIndex, {
489
+ key: 0,
490
+ column: column,
491
+ record: record,
492
+ index: record.__dataIndex,
493
+ visibleIndex: index
494
+ })
495
+ : _createCommentVNode("v-if", true)
478
496
  ]),
479
- _: 3 /* FORWARDED */
480
- }, 16 /* FULL_PROPS */, ["data-source", "columns", "scroll", "virtual"]),
497
+ _: 2 /* DYNAMIC */
498
+ }, [
499
+ _renderList(_ctx.$slots, (_, slotName) => {
500
+ return {
501
+ name: slotName,
502
+ fn: _withCtx((slotProps) => [
503
+ _renderSlot(_ctx.$slots, slotName, _normalizeProps(_guardReactiveProps(slotProps || {})))
504
+ ])
505
+ };
506
+ })
507
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["data-source", "columns", "scroll", "virtual"]),
481
508
  (__props.readonly)
482
509
  ? (_openBlock(), _createElementBlock("div", _hoisted_4))
483
510
  : _createCommentVNode("v-if", true),
@@ -41,7 +41,7 @@ const _hoisted_3 = {
41
41
  };
42
42
  import { computed, ref } from 'vue';
43
43
  import { isFunction } from 'lodash-es';
44
- import { AIcon, Empty, Ellipsis } from '../../../';
44
+ import { AIcon, Empty, Ellipsis } from '../../';
45
45
  import { Popconfirm, Button, FormItemRest, Popover, message } from 'ant-design-vue';
46
46
  import { useLocaleReceiver } from "../../LocaleReciver";
47
47
  import useSearchStyle from '../style';
@@ -7,6 +7,7 @@
7
7
  "deleteRequest": "props",
8
8
  "deleteKey": "props",
9
9
  "defaultValues": "props",
10
+ "saveButton": "props",
10
11
  "SearchItem": "setup-const",
11
12
  "typeOptions": "setup-maybe-ref",
12
13
  "useHandleColumns": "setup-maybe-ref",
@@ -92,14 +93,14 @@ import History from './History.js';
92
93
  import { compatibleOldTerms, getItemDefaultValue, termsParamsFormat, } from '../util';
93
94
  import { Select, Button, Form, FormItemRest } from 'ant-design-vue';
94
95
  import { AIcon } from '../../components';
95
- import { useLocaleReceiver } from "../../LocaleReciver";
96
- import { SearchConfig } from "../../utils/constants";
97
- import { isObject } from "lodash-es";
96
+ import { useLocaleReceiver } from '../../LocaleReciver';
97
+ import { SearchConfig } from '../../utils/constants';
98
+ import { isObject } from 'lodash-es';
98
99
  import useSearchStyle from '../style';
99
100
  const __sfc_main__ = _defineComponent({
100
101
  ...{
101
102
  name: 'JAdvancedSearch',
102
- inheritAttrs: false
103
+ inheritAttrs: false,
103
104
  },
104
105
  props: {
105
106
  columns: {
@@ -135,7 +136,11 @@ const __sfc_main__ = _defineComponent({
135
136
  defaultValues: {
136
137
  type: Object,
137
138
  default: undefined,
138
- }
139
+ },
140
+ saveButton: {
141
+ type: Boolean,
142
+ default: true,
143
+ },
139
144
  },
140
145
  emits: ['search', 'reset'],
141
146
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -159,7 +164,8 @@ const __sfc_main__ = _defineComponent({
159
164
  const expandChange = () => {
160
165
  expand.value = !expand.value;
161
166
  terms.terms.length = 1;
162
- if (expand.value) { // 展开
167
+ if (expand.value) {
168
+ // 展开
163
169
  let arr = Object.values(columnsMap.value);
164
170
  const mergeArr = [];
165
171
  for (let i = 1; i < 6; i++) {
@@ -266,11 +272,11 @@ const __sfc_main__ = _defineComponent({
266
272
  watch(() => props.target, () => {
267
273
  clearValue();
268
274
  }, {
269
- immediate: true
275
+ immediate: true,
270
276
  });
271
277
  __expose({
272
278
  setValues: handleDefaultValues,
273
- reset
279
+ reset,
274
280
  });
275
281
  return (_ctx, _cache) => {
276
282
  return (_openBlock(), _createBlock(_unref(Form), {
@@ -295,11 +301,7 @@ const __sfc_main__ = _defineComponent({
295
301
  ])
296
302
  }, [
297
303
  _createElementVNode("div", {
298
- class: _normalizeClass([
299
- 'JSearch-items',
300
- expand.value ? 'items-expand' : '',
301
- layout.value,
302
- ])
304
+ class: _normalizeClass(['JSearch-items', expand.value ? 'items-expand' : '', layout.value])
303
305
  }, [
304
306
  _createElementVNode("div", _hoisted_1, [
305
307
  _createElementVNode("div", _hoisted_2, [
@@ -359,10 +361,7 @@ const __sfc_main__ = _defineComponent({
359
361
  : _createCommentVNode("v-if", true)
360
362
  ], 2 /* CLASS */),
361
363
  _createElementVNode("div", {
362
- class: _normalizeClass([
363
- 'JSearch-footer',
364
- expand.value || compatible.value ? 'expand' : '',
365
- ])
364
+ class: _normalizeClass(['JSearch-footer', expand.value || compatible.value ? 'expand' : ''])
366
365
  }, [
367
366
  _renderSlot(_ctx.$slots, "footerRender", {
368
367
  reset: reset,
@@ -376,11 +375,14 @@ const __sfc_main__ = _defineComponent({
376
375
  ]),
377
376
  _: 1 /* STABLE */
378
377
  }),
379
- _createVNode(SaveHistory, {
380
- terms: terms,
381
- target: _unref(target),
382
- request: __props.request || _unref(context).saveRequest
383
- }, null, 8 /* PROPS */, ["terms", "target", "request"]),
378
+ (__props.saveButton !== false)
379
+ ? (_openBlock(), _createBlock(SaveHistory, {
380
+ key: 0,
381
+ terms: terms,
382
+ target: _unref(target),
383
+ request: __props.request || _unref(context).saveRequest
384
+ }, null, 8 /* PROPS */, ["terms", "target", "request"]))
385
+ : _createCommentVNode("v-if", true),
384
386
  _createVNode(History, {
385
387
  target: _unref(target),
386
388
  request: __props.historyRequest || _unref(context).historyRequest,
@@ -399,10 +401,7 @@ const __sfc_main__ = _defineComponent({
399
401
  _createElementVNode("span", _hoisted_7, _toDisplayString(_unref(contextLocale).advanced.more), 1 /* TEXT */),
400
402
  _createVNode(_unref(AIcon), {
401
403
  type: "DoubleRightOutlined",
402
- class: _normalizeClass([
403
- 'more-icon',
404
- expand.value ? 'more-up' : 'more-down',
405
- ])
404
+ class: _normalizeClass(['more-icon', expand.value ? 'more-up' : 'more-down'])
406
405
  }, null, 8 /* PROPS */, ["class"])
407
406
  ]),
408
407
  _: 1 /* STABLE */
@@ -16,6 +16,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
16
16
  } return value; }
17
17
  /* Analyzed bindings: {
18
18
  "searchKey": "props",
19
+ "multiple": "props",
19
20
  "Select": "setup-maybe-ref",
20
21
  "selectProps": "setup-maybe-ref",
21
22
  "ref": "setup-const",
@@ -34,10 +35,10 @@ import { defineComponent as _defineComponent } from 'vue';
34
35
  import { unref as _unref, mergeProps as _mergeProps, openBlock as _openBlock, createBlock as _createBlock } from "vue";
35
36
  import { Select } from 'ant-design-vue';
36
37
  import { selectProps } from 'ant-design-vue/lib/select';
37
- import { ref, watch, computed } from 'vue';
38
+ import { ref, watch, computed, } from 'vue';
38
39
  const __sfc_main__ = _defineComponent({
39
40
  ...{
40
- name: 'JAutoComplete'
41
+ name: 'JAutoComplete',
41
42
  },
42
43
  props: {
43
44
  ...selectProps(),
@@ -45,6 +46,10 @@ const __sfc_main__ = _defineComponent({
45
46
  type: String,
46
47
  default: 'label',
47
48
  },
49
+ multiple: {
50
+ type: Boolean,
51
+ default: true,
52
+ },
48
53
  },
49
54
  emits: ["select", "change", "update:value"],
50
55
  setup(__props, { emit: __emit }) {
@@ -59,27 +64,30 @@ const __sfc_main__ = _defineComponent({
59
64
  }
60
65
  };
61
66
  const _options = computed(() => {
62
- const item = props.options.find(option => option.value === myValue.value);
67
+ const item = props.options.find((option) => option.value === myValue.value);
63
68
  if (item || !myValue.value) {
64
69
  _label.value = _optionalChain([item, 'optionalAccess', _ => _.label]);
65
70
  return props.options;
66
71
  }
67
72
  _label.value = myValue.value;
68
- return [
69
- { label: myValue.value, value: myValue.value },
70
- ...props.options
71
- ];
73
+ return [{ label: myValue.value, value: myValue.value }, ...props.options];
72
74
  });
73
75
  const handleSearch = (e) => {
74
76
  myValue.value = e;
75
77
  };
76
78
  const onSelect = (val, option) => {
77
- myValue.value = val;
78
- emit('update:value', val);
79
- emit('select', val, option);
79
+ let _val = val;
80
+ let _option = option;
81
+ if (props.multiple === false) {
82
+ _val = val[0];
83
+ _option = option[0];
84
+ }
85
+ myValue.value = [_val];
86
+ emit('update:value', _val);
87
+ emit('select', _val, _option);
80
88
  };
81
89
  watch(() => props.value, (val) => {
82
- myValue.value = val;
90
+ myValue.value = props.multiple ? [val] : val;
83
91
  }, { immediate: true });
84
92
  return (_ctx, _cache) => {
85
93
  return (_openBlock(), _createBlock(_unref(Select), _mergeProps({
@@ -97,7 +97,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
97
97
  "onScrollDown": "setup-const"
98
98
  } */
99
99
  import { defineComponent as _defineComponent } from 'vue';
100
- import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, mergeProps as _mergeProps, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, normalizeClass as _normalizeClass } from "vue";
100
+ import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, mergeProps as _mergeProps, withCtx as _withCtx, renderList as _renderList, createSlots as _createSlots, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createBlock as _createBlock, normalizeClass as _normalizeClass } from "vue";
101
101
  const _hoisted_1 = { class: "jetlinks-edit-table-extra" };
102
102
  const _hoisted_2 = { class: "jetlinks-edit-table" };
103
103
  const _hoisted_3 = { class: "jetlinks-edit-table-body" };
@@ -105,47 +105,54 @@ const _hoisted_4 = {
105
105
  key: 0,
106
106
  class: "readonly-mask"
107
107
  };
108
- import { FULL_SCREEN, RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_GROUP_ACTIVE, TABLE_GROUP_ERROR, TABLE_GROUP_OPTIONS, TABLE_H_SCROLL, TABLE_OPEN_GROUP, TABLE_TOOL, TABLE_WRAPPER } from './consts';
108
+ import { FULL_SCREEN, RIGHT_MENU, TABLE_DATA_SOURCE, TABLE_ERROR, TABLE_GROUP_ACTIVE, TABLE_GROUP_ERROR, TABLE_GROUP_OPTIONS, TABLE_H_SCROLL, TABLE_OPEN_GROUP, TABLE_TOOL, TABLE_WRAPPER, } from './consts';
109
109
  import { useGroup, useValidate } from './hooks';
110
110
  import { tableProps } from 'ant-design-vue/lib/table';
111
111
  import { useFormContext } from './context';
112
112
  import { useFullscreen } from '@vueuse/core';
113
113
  import { provide, useSlots, ref, reactive, computed, watch } from 'vue';
114
- import { bodyProps } from "./props";
114
+ import { bodyProps } from './props';
115
115
  import { findIndex, get, sortBy } from 'lodash-es';
116
116
  import Group from './group.js';
117
117
  import VirtualTable from '../VirtualTable/Table';
118
- import { useLocaleReceiver } from "../LocaleReciver";
118
+ import { useLocaleReceiver } from '../LocaleReciver';
119
119
  import useEditTableStyle from './style';
120
120
  const defaultGroupId = 'group_1';
121
121
  const __sfc_main__ = _defineComponent({
122
122
  ...{
123
- name: 'JEditTable'
123
+ name: 'JEditTable',
124
124
  },
125
125
  props: {
126
126
  ...tableProps(),
127
127
  ...bodyProps(),
128
128
  searchColumns: {
129
129
  type: Array,
130
- default: undefined
130
+ default: undefined,
131
131
  },
132
132
  serial: {
133
133
  type: [Object, Boolean],
134
134
  default: () => ({
135
135
  width: 70,
136
- title: ''
137
- })
136
+ title: '',
137
+ }),
138
138
  },
139
139
  validateRowKey: {
140
140
  type: Boolean,
141
- default: false
141
+ default: false,
142
142
  },
143
143
  readonly: {
144
144
  type: Boolean,
145
- default: false
146
- }
145
+ default: false,
146
+ },
147
147
  },
148
- emits: ['scrollDown', 'rightMenuClick', 'editChange', 'searchVisibleChange', 'groupDelete', 'groupEdit'],
148
+ emits: [
149
+ 'scrollDown',
150
+ 'rightMenuClick',
151
+ 'editChange',
152
+ 'searchVisibleChange',
153
+ 'groupDelete',
154
+ 'groupEdit',
155
+ ],
149
156
  setup(__props, { expose: __expose, emit: __emit }) {
150
157
  const emit = __emit;
151
158
  const [contextLocale] = useLocaleReceiver('EditTable');
@@ -165,9 +172,9 @@ const __sfc_main__ = _defineComponent({
165
172
  key: undefined,
166
173
  order: undefined,
167
174
  orderKeys: [],
168
- dataIndex: undefined
175
+ dataIndex: undefined,
169
176
  });
170
- const { groupActive, groupOptions, addGroup, removeGroup, updateGroupActive, updateGroupOptions } = useGroup(props.openGroup);
177
+ const { groupActive, groupOptions, addGroup, removeGroup, updateGroupActive, updateGroupOptions, } = useGroup(props.openGroup);
171
178
  // 处理数据源
172
179
  const _dataSource = computed(() => {
173
180
  const _options = new Map();
@@ -185,7 +192,8 @@ const __sfc_main__ = _defineComponent({
185
192
  const _groupId = _optionalChain([item, 'access', _2 => _2.expands, 'optionalAccess', _3 => _3.groupId]);
186
193
  if (!_groupId) {
187
194
  item.expands.groupId = groupActive.value || defaultGroupId;
188
- item.expands.groupName = groupActive.label || (contextLocale.value.Group.one + '1');
195
+ item.expands.groupName =
196
+ groupActive.label || contextLocale.value.Group.one + '1';
189
197
  }
190
198
  const _optionsItem = _options.get(item.expands.groupId);
191
199
  if (!_optionsItem) {
@@ -193,7 +201,7 @@ const __sfc_main__ = _defineComponent({
193
201
  value: _optionalChain([item, 'access', _4 => _4.expands, 'optionalAccess', _5 => _5.groupId]),
194
202
  label: _optionalChain([item, 'access', _6 => _6.expands, 'optionalAccess', _7 => _7.groupName]),
195
203
  effective: item.id ? 1 : 0,
196
- len: 1
204
+ len: 1,
197
205
  });
198
206
  }
199
207
  else {
@@ -225,7 +233,7 @@ const __sfc_main__ = _defineComponent({
225
233
  });
226
234
  const scroll = computed(() => {
227
235
  const _scroll = {
228
- y: props.height
236
+ y: props.height,
229
237
  };
230
238
  if (_optionalChain([props, 'access', _9 => _9.scroll, 'optionalAccess', _10 => _10.x])) {
231
239
  _scroll.x = props.scroll.x;
@@ -241,7 +249,9 @@ const __sfc_main__ = _defineComponent({
241
249
  err.forEach((item, errIndex) => {
242
250
  item.forEach((e, eIndex) => {
243
251
  const field = findField(e.__dataIndex, e.field);
244
- const _eventKey = field ? field.eventKey : `${e.__dataIndex}-${e.field}`;
252
+ const _eventKey = field
253
+ ? field.eventKey
254
+ : `${e.__dataIndex}-${e.field}`;
245
255
  if (field) {
246
256
  field.showErrorTip(e.message);
247
257
  }
@@ -265,12 +275,15 @@ const __sfc_main__ = _defineComponent({
265
275
  onEdit: () => {
266
276
  emit('editChange', true);
267
277
  },
268
- validateRowKey: props.validateRowKey
278
+ validateRowKey: props.validateRowKey,
269
279
  });
270
280
  // Provide context
271
281
  provide(TABLE_WRAPPER, tableWrapper);
272
282
  provide(FULL_SCREEN, isFullscreen);
273
- provide(RIGHT_MENU, { click: rightMenu, getPopupContainer: () => tableWrapper.value });
283
+ provide(RIGHT_MENU, {
284
+ click: rightMenu,
285
+ getPopupContainer: () => tableWrapper.value,
286
+ });
274
287
  provide(TABLE_ERROR, fieldsErrMap);
275
288
  provide(TABLE_GROUP_ERROR, fieldsGroupError);
276
289
  provide(TABLE_DATA_SOURCE, _dataSource);
@@ -300,7 +313,7 @@ const __sfc_main__ = _defineComponent({
300
313
  sortData.orderKeys = [];
301
314
  sortData.dataIndex = undefined;
302
315
  },
303
- sortData
316
+ sortData,
304
317
  });
305
318
  provide(TABLE_GROUP_OPTIONS, groupOptions);
306
319
  provide(TABLE_GROUP_ACTIVE, groupActive);
@@ -328,7 +341,9 @@ const __sfc_main__ = _defineComponent({
328
341
  fieldsErrMap.value[key] = message;
329
342
  }
330
343
  const scrollWidth = computed(() => {
331
- return (props.dataSource.length * props.cellHeight) > props.height ? scrollDefaultWidth.value : 0;
344
+ return props.dataSource.length * props.cellHeight > props.height
345
+ ? scrollDefaultWidth.value
346
+ : 0;
332
347
  });
333
348
  const newColumns = computed(() => {
334
349
  const _columns = [];
@@ -344,7 +359,7 @@ const __sfc_main__ = _defineComponent({
344
359
  return record.__serial;
345
360
  },
346
361
  width: _optionalChain([(props.serial), 'optionalAccess', _14 => _14.width]),
347
- fixed: 'left'
362
+ fixed: 'left',
348
363
  };
349
364
  _columns.push(serial);
350
365
  }
@@ -369,7 +384,7 @@ const __sfc_main__ = _defineComponent({
369
384
  };
370
385
  const groupDelete = (id, index) => {
371
386
  removeGroup(index);
372
- Object.keys(fieldsErrMap.value).forEach(errorKey => {
387
+ Object.keys(fieldsErrMap.value).forEach((errorKey) => {
373
388
  const [idx] = errorKey.split('-');
374
389
  const dataSourceItem = _dataSource.value[parseInt(idx)];
375
390
  const groupId = _optionalChain([dataSourceItem, 'optionalAccess', _15 => _15.expands, 'optionalAccess', _16 => _16.groupId]);
@@ -396,7 +411,7 @@ const __sfc_main__ = _defineComponent({
396
411
  if (props.openGroup) {
397
412
  const _errorObj = errorMap;
398
413
  const groupErrorMap = {};
399
- Object.keys(_errorObj).forEach(errorKey => {
414
+ Object.keys(_errorObj).forEach((errorKey) => {
400
415
  const [index] = errorKey.split('-');
401
416
  const dataSourceItem = _dataSource.value[parseInt(index)];
402
417
  const groupId = _optionalChain([dataSourceItem, 'optionalAccess', _17 => _17.expands, 'optionalAccess', _18 => _18.groupId]);
@@ -405,8 +420,8 @@ const __sfc_main__ = _defineComponent({
405
420
  [errorKey]: {
406
421
  message: _errorObj[errorKey],
407
422
  index,
408
- serial: dataSourceItem.__serial
409
- }
423
+ serial: dataSourceItem.__serial,
424
+ },
410
425
  };
411
426
  if (groupError) {
412
427
  groupError.push(groupErrorItem);
@@ -426,7 +441,7 @@ const __sfc_main__ = _defineComponent({
426
441
  removeField,
427
442
  removeFieldError,
428
443
  addFieldError,
429
- validateItem
444
+ validateItem,
430
445
  });
431
446
  __expose({
432
447
  validate,
@@ -434,14 +449,14 @@ const __sfc_main__ = _defineComponent({
434
449
  scrollToById,
435
450
  scrollToByIndex,
436
451
  getTableWrapperRef,
437
- getGroupActive
452
+ getGroupActive,
438
453
  });
439
454
  return (_ctx, _cache) => {
440
455
  return (_openBlock(), _createElementBlock("div", {
441
456
  class: _normalizeClass({
442
457
  'jetlinks-edit-table-wrapper': true,
443
458
  'table-full-screen': _unref(isFullscreen),
444
- [_unref(hashId)]: true
459
+ [_unref(hashId)]: true,
445
460
  }),
446
461
  ref_key: "tableWrapper",
447
462
  ref: tableWrapper
@@ -457,7 +472,7 @@ const __sfc_main__ = _defineComponent({
457
472
  _createVNode(_unref(VirtualTable), _mergeProps({
458
473
  ref_key: "virtualTableRef",
459
474
  ref: virtualTableRef
460
- }, props, {
475
+ }, _ctx.$attrs, {
461
476
  "data-source": bodyDataSource.value,
462
477
  columns: newColumns.value,
463
478
  scroll: scroll.value,
@@ -465,19 +480,31 @@ const __sfc_main__ = _defineComponent({
465
480
  virtual: {
466
481
  itemHeight: props.cellHeight,
467
482
  overscan: 5,
468
- threshold: props.height / props.cellHeight
483
+ threshold: props.height / props.cellHeight,
469
484
  }
470
- }), {
485
+ }), _createSlots({
471
486
  bodyCell: _withCtx(({ column, record, index }) => [
472
- _renderSlot(_ctx.$slots, column.dataIndex, {
473
- column: column,
474
- record: record,
475
- index: record.__dataIndex,
476
- visibleIndex: index
477
- })
487
+ (_ctx.$slots[column.dataIndex])
488
+ ? _renderSlot(_ctx.$slots, column.dataIndex, {
489
+ key: 0,
490
+ column: column,
491
+ record: record,
492
+ index: record.__dataIndex,
493
+ visibleIndex: index
494
+ })
495
+ : _createCommentVNode("v-if", true)
478
496
  ]),
479
- _: 3 /* FORWARDED */
480
- }, 16 /* FULL_PROPS */, ["data-source", "columns", "scroll", "virtual"]),
497
+ _: 2 /* DYNAMIC */
498
+ }, [
499
+ _renderList(_ctx.$slots, (_, slotName) => {
500
+ return {
501
+ name: slotName,
502
+ fn: _withCtx((slotProps) => [
503
+ _renderSlot(_ctx.$slots, slotName, _normalizeProps(_guardReactiveProps(slotProps || {})))
504
+ ])
505
+ };
506
+ })
507
+ ]), 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["data-source", "columns", "scroll", "virtual"]),
481
508
  (__props.readonly)
482
509
  ? (_openBlock(), _createElementBlock("div", _hoisted_4))
483
510
  : _createCommentVNode("v-if", true),
@@ -41,7 +41,7 @@ const _hoisted_3 = {
41
41
  };
42
42
  import { computed, ref } from 'vue';
43
43
  import { isFunction } from 'lodash-es';
44
- import { AIcon, Empty, Ellipsis } from '../../../';
44
+ import { AIcon, Empty, Ellipsis } from '../../';
45
45
  import { Popconfirm, Button, FormItemRest, Popover, message } from 'ant-design-vue';
46
46
  import { useLocaleReceiver } from "../../LocaleReciver";
47
47
  import useSearchStyle from '../style';
@@ -7,6 +7,7 @@
7
7
  "deleteRequest": "props",
8
8
  "deleteKey": "props",
9
9
  "defaultValues": "props",
10
+ "saveButton": "props",
10
11
  "SearchItem": "setup-const",
11
12
  "typeOptions": "setup-maybe-ref",
12
13
  "useHandleColumns": "setup-maybe-ref",
@@ -92,14 +93,14 @@ import History from './History.js';
92
93
  import { compatibleOldTerms, getItemDefaultValue, termsParamsFormat, } from '../util';
93
94
  import { Select, Button, Form, FormItemRest } from 'ant-design-vue';
94
95
  import { AIcon } from '../../components';
95
- import { useLocaleReceiver } from "../../LocaleReciver";
96
- import { SearchConfig } from "../../utils/constants";
97
- import { isObject } from "lodash-es";
96
+ import { useLocaleReceiver } from '../../LocaleReciver';
97
+ import { SearchConfig } from '../../utils/constants';
98
+ import { isObject } from 'lodash-es';
98
99
  import useSearchStyle from '../style';
99
100
  const __sfc_main__ = _defineComponent({
100
101
  ...{
101
102
  name: 'JAdvancedSearch',
102
- inheritAttrs: false
103
+ inheritAttrs: false,
103
104
  },
104
105
  props: {
105
106
  columns: {
@@ -135,7 +136,11 @@ const __sfc_main__ = _defineComponent({
135
136
  defaultValues: {
136
137
  type: Object,
137
138
  default: undefined,
138
- }
139
+ },
140
+ saveButton: {
141
+ type: Boolean,
142
+ default: true,
143
+ },
139
144
  },
140
145
  emits: ['search', 'reset'],
141
146
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -159,7 +164,8 @@ const __sfc_main__ = _defineComponent({
159
164
  const expandChange = () => {
160
165
  expand.value = !expand.value;
161
166
  terms.terms.length = 1;
162
- if (expand.value) { // 展开
167
+ if (expand.value) {
168
+ // 展开
163
169
  let arr = Object.values(columnsMap.value);
164
170
  const mergeArr = [];
165
171
  for (let i = 1; i < 6; i++) {
@@ -266,11 +272,11 @@ const __sfc_main__ = _defineComponent({
266
272
  watch(() => props.target, () => {
267
273
  clearValue();
268
274
  }, {
269
- immediate: true
275
+ immediate: true,
270
276
  });
271
277
  __expose({
272
278
  setValues: handleDefaultValues,
273
- reset
279
+ reset,
274
280
  });
275
281
  return (_ctx, _cache) => {
276
282
  return (_openBlock(), _createBlock(_unref(Form), {
@@ -295,11 +301,7 @@ const __sfc_main__ = _defineComponent({
295
301
  ])
296
302
  }, [
297
303
  _createElementVNode("div", {
298
- class: _normalizeClass([
299
- 'JSearch-items',
300
- expand.value ? 'items-expand' : '',
301
- layout.value,
302
- ])
304
+ class: _normalizeClass(['JSearch-items', expand.value ? 'items-expand' : '', layout.value])
303
305
  }, [
304
306
  _createElementVNode("div", _hoisted_1, [
305
307
  _createElementVNode("div", _hoisted_2, [
@@ -359,10 +361,7 @@ const __sfc_main__ = _defineComponent({
359
361
  : _createCommentVNode("v-if", true)
360
362
  ], 2 /* CLASS */),
361
363
  _createElementVNode("div", {
362
- class: _normalizeClass([
363
- 'JSearch-footer',
364
- expand.value || compatible.value ? 'expand' : '',
365
- ])
364
+ class: _normalizeClass(['JSearch-footer', expand.value || compatible.value ? 'expand' : ''])
366
365
  }, [
367
366
  _renderSlot(_ctx.$slots, "footerRender", {
368
367
  reset: reset,
@@ -376,11 +375,14 @@ const __sfc_main__ = _defineComponent({
376
375
  ]),
377
376
  _: 1 /* STABLE */
378
377
  }),
379
- _createVNode(SaveHistory, {
380
- terms: terms,
381
- target: _unref(target),
382
- request: __props.request || _unref(context).saveRequest
383
- }, null, 8 /* PROPS */, ["terms", "target", "request"]),
378
+ (__props.saveButton !== false)
379
+ ? (_openBlock(), _createBlock(SaveHistory, {
380
+ key: 0,
381
+ terms: terms,
382
+ target: _unref(target),
383
+ request: __props.request || _unref(context).saveRequest
384
+ }, null, 8 /* PROPS */, ["terms", "target", "request"]))
385
+ : _createCommentVNode("v-if", true),
384
386
  _createVNode(History, {
385
387
  target: _unref(target),
386
388
  request: __props.historyRequest || _unref(context).historyRequest,
@@ -399,10 +401,7 @@ const __sfc_main__ = _defineComponent({
399
401
  _createElementVNode("span", _hoisted_7, _toDisplayString(_unref(contextLocale).advanced.more), 1 /* TEXT */),
400
402
  _createVNode(_unref(AIcon), {
401
403
  type: "DoubleRightOutlined",
402
- class: _normalizeClass([
403
- 'more-icon',
404
- expand.value ? 'more-up' : 'more-down',
405
- ])
404
+ class: _normalizeClass(['more-icon', expand.value ? 'more-up' : 'more-down'])
406
405
  }, null, 8 /* PROPS */, ["class"])
407
406
  ]),
408
407
  _: 1 /* STABLE */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "3.2.3",
3
+ "version": "3.2.5",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -154,8 +154,8 @@
154
154
  "webpack-dev-server": "^4.0.0",
155
155
  "webpack-merge": "^5.0.0",
156
156
  "webpackbar": "^5.0.2",
157
- "@jetlinks-web/constants": "^1.0.9",
158
157
  "@jetlinks-web/hooks": "^1.1.1",
158
+ "@jetlinks-web/constants": "^1.0.9",
159
159
  "@jetlinks-web/utils": "^1.2.12"
160
160
  },
161
161
  "publishConfig": {