@jetlinks-web/components 3.2.3 → 3.2.6

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.
@@ -1,3 +1,9 @@
1
+ function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) {
2
+ return lhs;
3
+ }
4
+ else {
5
+ return rhsFn();
6
+ } }
1
7
  function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
8
  const op = ops[i];
3
9
  const fn = ops[i + 1];
@@ -16,6 +22,8 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
16
22
  } return value; }
17
23
  /* Analyzed bindings: {
18
24
  "searchKey": "props",
25
+ "multiple": "props",
26
+ "AutoComplete": "setup-maybe-ref",
19
27
  "Select": "setup-maybe-ref",
20
28
  "selectProps": "setup-maybe-ref",
21
29
  "ref": "setup-const",
@@ -24,20 +32,30 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
24
32
  "props": "setup-reactive-const",
25
33
  "emit": "setup-const",
26
34
  "myValue": "setup-ref",
27
- "_label": "setup-ref",
28
- "handleChange": "setup-const",
29
- "_options": "setup-ref",
35
+ "searchValue": "setup-ref",
36
+ "customOptions": "setup-ref",
37
+ "isEmpty": "setup-const",
38
+ "normalizeText": "setup-const",
39
+ "isOptionMatched": "setup-const",
40
+ "componentProps": "setup-ref",
41
+ "mergedOptions": "setup-ref",
42
+ "displayOptions": "setup-ref",
43
+ "appendCustomOption": "setup-const",
30
44
  "handleSearch": "setup-const",
31
- "onSelect": "setup-const"
45
+ "handleMultipleChange": "setup-const",
46
+ "handleSingleChange": "setup-const",
47
+ "handleSingleBlur": "setup-const",
48
+ "onSelect": "setup-const",
49
+ "normalizeValueByMode": "setup-const"
32
50
  } */
33
51
  import { defineComponent as _defineComponent } from 'vue';
34
- import { unref as _unref, mergeProps as _mergeProps, openBlock as _openBlock, createBlock as _createBlock } from "vue";
35
- import { Select } from 'ant-design-vue';
52
+ import { unref as _unref, mergeProps as _mergeProps, openBlock as _openBlock, createBlock as _createBlock, } from "vue";
53
+ import { AutoComplete, Select } from 'ant-design-vue';
36
54
  import { selectProps } from 'ant-design-vue/lib/select';
37
- import { ref, watch, computed } from 'vue';
55
+ import { ref, watch, computed, } from 'vue';
38
56
  const __sfc_main__ = _defineComponent({
39
57
  ...{
40
- name: 'JAutoComplete'
58
+ name: 'JAutoComplete',
41
59
  },
42
60
  props: {
43
61
  ...selectProps(),
@@ -45,55 +63,147 @@ const __sfc_main__ = _defineComponent({
45
63
  type: String,
46
64
  default: 'label',
47
65
  },
66
+ multiple: {
67
+ type: Boolean,
68
+ default: true,
69
+ },
48
70
  },
49
71
  emits: ["select", "change", "update:value"],
50
72
  setup(__props, { emit: __emit }) {
51
73
  const props = __props;
52
74
  const emit = __emit;
53
75
  const myValue = ref();
54
- const _label = ref();
55
- const handleChange = (e) => {
56
- if (e.length === 0) {
57
- myValue.value = undefined;
58
- emit('update:value', undefined);
76
+ const searchValue = ref('');
77
+ const customOptions = ref([]);
78
+ const isEmpty = (val) => val === undefined || val === null || val === '';
79
+ const normalizeText = (val) => {
80
+ if (isEmpty(val)) {
81
+ return '';
82
+ }
83
+ if (typeof val === 'object' && val !== null && 'value' in val) {
84
+ return String(_nullishCoalesce(val.value, () => (''))).trim();
59
85
  }
86
+ return String(val).trim();
87
+ };
88
+ const isOptionMatched = (option, keyword) => {
89
+ const optionValue = normalizeText(_optionalChain([option, 'optionalAccess', _ => _.value]));
90
+ const optionLabel = normalizeText(_nullishCoalesce(_optionalChain([option, 'optionalAccess', _2 => _2[props.searchKey]]), () => (_optionalChain([option, 'optionalAccess', _3 => _3.label]))));
91
+ return optionValue === keyword || optionLabel === keyword;
60
92
  };
61
- const _options = computed(() => {
62
- const item = props.options.find(option => option.value === myValue.value);
63
- if (item || !myValue.value) {
64
- _label.value = _optionalChain([item, 'optionalAccess', _ => _.label]);
65
- return props.options;
93
+ const componentProps = computed(() => {
94
+ const { multiple, searchKey, options, value, mode, ...rest } = props;
95
+ return rest;
96
+ });
97
+ const mergedOptions = computed(() => {
98
+ const baseOptions = Array.isArray(props.options)
99
+ ? (props.options)
100
+ : [];
101
+ const result = [];
102
+ const keys = new Set();
103
+ [...customOptions.value, ...baseOptions].forEach((option) => {
104
+ const key = normalizeText(_optionalChain([option, 'optionalAccess', _4 => _4.value]) || _optionalChain([option, 'optionalAccess', _5 => _5[props.searchKey]]) || _optionalChain([option, 'optionalAccess', _6 => _6.label]));
105
+ if (!key || keys.has(key)) {
106
+ return;
107
+ }
108
+ keys.add(key);
109
+ result.push(option);
110
+ });
111
+ return result;
112
+ });
113
+ const displayOptions = computed(() => {
114
+ const keyword = normalizeText(searchValue.value);
115
+ if (!keyword) {
116
+ return mergedOptions.value;
66
117
  }
67
- _label.value = myValue.value;
68
- return [
69
- { label: myValue.value, value: myValue.value },
70
- ...props.options
71
- ];
118
+ const exists = mergedOptions.value.some((option) => isOptionMatched(option, keyword));
119
+ if (exists) {
120
+ return mergedOptions.value;
121
+ }
122
+ return [{ label: keyword, value: keyword }, ...mergedOptions.value];
72
123
  });
73
- const handleSearch = (e) => {
74
- myValue.value = e;
124
+ const appendCustomOption = (val) => {
125
+ const keyword = normalizeText(val);
126
+ if (!keyword) {
127
+ return;
128
+ }
129
+ const exists = mergedOptions.value.some((option) => isOptionMatched(option, keyword));
130
+ if (exists) {
131
+ return;
132
+ }
133
+ customOptions.value = [{ label: keyword, value: keyword }, ...customOptions.value];
134
+ };
135
+ const handleSearch = (val) => {
136
+ searchValue.value = normalizeText(val);
137
+ };
138
+ const handleMultipleChange = (val) => {
139
+ const nextValue = Array.isArray(val)
140
+ ? val
141
+ : isEmpty(val)
142
+ ? []
143
+ : [val];
144
+ nextValue.forEach((item) => appendCustomOption(item));
145
+ myValue.value = nextValue;
146
+ emit('update:value', nextValue);
147
+ emit('change', nextValue);
148
+ };
149
+ const handleSingleChange = (val) => {
150
+ const nextValue = isEmpty(val) ? undefined : val;
151
+ myValue.value = nextValue;
152
+ emit('update:value', nextValue);
153
+ emit('change', nextValue);
154
+ };
155
+ const handleSingleBlur = () => {
156
+ appendCustomOption(myValue.value);
75
157
  };
76
158
  const onSelect = (val, option) => {
77
- myValue.value = val;
78
- emit('update:value', val);
159
+ appendCustomOption(val);
79
160
  emit('select', val, option);
80
161
  };
81
- watch(() => props.value, (val) => {
82
- myValue.value = val;
162
+ const normalizeValueByMode = (val) => {
163
+ if (isEmpty(val)) {
164
+ return props.multiple ? [] : undefined;
165
+ }
166
+ if (props.multiple) {
167
+ return Array.isArray(val) ? val : [val];
168
+ }
169
+ return Array.isArray(val) ? val[val.length - 1] : val;
170
+ };
171
+ watch([() => props.value, () => props.multiple], ([val]) => {
172
+ const nextValue = normalizeValueByMode(val);
173
+ myValue.value = nextValue;
174
+ if (Array.isArray(nextValue)) {
175
+ nextValue.forEach((item) => appendCustomOption(item));
176
+ }
177
+ else {
178
+ appendCustomOption(nextValue);
179
+ }
83
180
  }, { immediate: true });
84
181
  return (_ctx, _cache) => {
85
- return (_openBlock(), _createBlock(_unref(Select), _mergeProps({
86
- value: myValue.value,
87
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => ((myValue).value = $event)),
88
- allowClear: ""
89
- }, props, {
90
- options: _options.value,
91
- mode: "tags",
92
- style: { "width": "100%" },
93
- onSelect: onSelect,
94
- onSearch: handleSearch,
95
- onChange: handleChange
96
- }), null, 16 /* FULL_PROPS */, ["value", "options"]));
182
+ return (props.multiple)
183
+ ? (_openBlock(), _createBlock(_unref(Select), _mergeProps({
184
+ key: 0,
185
+ value: myValue.value,
186
+ allowClear: ""
187
+ }, componentProps.value, {
188
+ mode: "tags",
189
+ options: displayOptions.value,
190
+ style: { "width": "100%" },
191
+ onSelect: onSelect,
192
+ onSearch: handleSearch,
193
+ onChange: handleMultipleChange
194
+ }), null, 16 /* FULL_PROPS */, ["value", "options"]))
195
+ : (_openBlock(), _createBlock(_unref(AutoComplete), _mergeProps({
196
+ key: 1,
197
+ value: myValue.value,
198
+ allowClear: ""
199
+ }, componentProps.value, {
200
+ options: displayOptions.value,
201
+ style: { "width": "100%" },
202
+ onSelect: onSelect,
203
+ onSearch: handleSearch,
204
+ onChange: handleSingleChange,
205
+ onBlur: handleSingleBlur
206
+ }), null, 16 /* FULL_PROPS */, ["value", "options"]));
97
207
  };
98
208
  }
99
209
  });
@@ -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),
@@ -210,6 +210,7 @@ export default defineComponent({
210
210
  var collapsedButtonRender = getSlot(slots, props, 'collapsedButtonRender');
211
211
  var headerContentRender = getSlot(slots, props, 'headerContentRender');
212
212
  var rightContentRender = getSlot(slots, props, 'rightContentRender');
213
+ var leftContentRender = getSlot(slots, props, 'leftContentRender');
213
214
  var customHeaderRender = getSlot(slots, props, 'headerRender');
214
215
  // menu
215
216
  var menuHeaderRender = getSlot(slots, props, 'menuHeaderRender');
@@ -232,6 +233,7 @@ export default defineComponent({
232
233
  onSelect: onSelect,
233
234
  onMenuHeaderClick: onMenuHeaderClick,
234
235
  rightContentRender: rightContentRender,
236
+ leftContentRender: leftContentRender,
235
237
  collapsedButtonRender: collapsedButtonRender,
236
238
  headerTitleRender: menuHeaderRender,
237
239
  menuExtraRender: menuExtraRender,
@@ -26,6 +26,12 @@ export var headerViewProps = _objectSpread(_objectSpread({}, baseHeaderProps), {
26
26
  return undefined;
27
27
  }
28
28
  },
29
+ leftContentRender: {
30
+ type: [Object, Function, Boolean],
31
+ default: function _default() {
32
+ return undefined;
33
+ }
34
+ },
29
35
  hasSiderMenu: PropTypes.looseBool,
30
36
  siderWidth: PropTypes.number.def(208)
31
37
  });
@@ -56,6 +62,7 @@ export default defineComponent({
56
62
  "theme": theme.value,
57
63
  "mode": "horizontal"
58
64
  }, props), {}, {
65
+ "leftContentRender": props.leftContentRender,
59
66
  "onCollapse": onCollapse.value,
60
67
  "menuData": context.menuData
61
68
  }), null);
@@ -50,6 +50,12 @@ export var baseHeaderProps = _objectSpread(_objectSpread({}, defaultSettingProps
50
50
  return undefined;
51
51
  }
52
52
  },
53
+ leftContentRender: {
54
+ type: [Object, Function],
55
+ default: function _default() {
56
+ return undefined;
57
+ }
58
+ },
53
59
  collapsedButtonRender: siderMenuProps.collapsedButtonRender,
54
60
  matchMenuKeys: siderMenuProps.matchMenuKeys,
55
61
  // events
@@ -90,6 +96,7 @@ export var TopNavHeader = function TopNavHeader(props) {
90
96
  onOpenKeys = props.onOpenKeys,
91
97
  onSelect = props.onSelect,
92
98
  contentWidth = props.contentWidth,
99
+ leftContentRender = props.leftContentRender,
93
100
  rightContentRender = props.rightContentRender,
94
101
  topHeaderMenuRender = props.topHeaderMenuRender,
95
102
  layout = props.layout,
@@ -146,7 +153,9 @@ export var TopNavHeader = function TopNavHeader(props) {
146
153
  "class": "".concat(prefixCls, "-logo"),
147
154
  "key": "logo",
148
155
  "id": "logo"
149
- }, [headerDom])]), _createVNode("div", {
156
+ }, [headerDom])]), leftContentRender && _createVNode("div", {
157
+ "class": "".concat(prefixCls, "-left-content")
158
+ }, [typeof leftContentRender === 'function' ? leftContentRender(_objectSpread({}, props)) : leftContentRender]), _createVNode("div", {
150
159
  "style": {
151
160
  flex: 1
152
161
  },
@@ -84,13 +84,17 @@ export var genTopHeaderStyle = function genTopHeaderStyle(config) {
84
84
  }
85
85
  }), '.anticon', {
86
86
  color: 'inherit'
87
- })), "".concat(topNavHeaderCls, "-main"), _defineProperty({
87
+ })), "".concat(topNavHeaderCls, "-main"), _defineProperty(_defineProperty({
88
88
  display: 'flex',
89
89
  height: '100%',
90
90
  paddingLeft: '16px'
91
91
  }, "".concat(topNavHeaderCls, "-main-left"), {
92
92
  display: 'flex',
93
93
  minWidth: '192px'
94
+ }), "".concat(topNavHeaderCls, "-left-content"), {
95
+ display: 'flex',
96
+ alignItems: 'center',
97
+ marginInlineEnd: '16px'
94
98
  })), '.anticon', {
95
99
  color: '#fff'
96
100
  }), "".concat(topNavHeaderCls, "-logo"), {
@@ -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';