@lx-frontend/wrap-element-ui 1.0.24-beta.7 → 1.0.25

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.
package/README.md CHANGED
@@ -43,3 +43,14 @@ export default {
43
43
  `build:sb` 用于生成 stories 静态预览文件。
44
44
 
45
45
  `pnpm preview` 用于预览`build:sb`生成的静态文件。
46
+
47
+ ### 已知问题
48
+
49
+ 1. **Storybook Setup API 无法动态更新 Controls**
50
+ - 使用 Storybook 的 setup API 时,无法动态更新 controls 面板的内容。建议使用 Vue 2 老版本的 Options API 写法。
51
+
52
+ 2. **Options API 中 this 指向问题**
53
+ - 在 Storybook 中使用 Options API 写法时,无法正确获取 `this` 指向。建议尽量避免 hook 的嵌套导致 `this` 丢失问题。虽然可以通过传递 Vue 实例的方式来解决,但请尽量保持 demo 的简单性和可读性。
54
+
55
+ 3. **Storybook 卡死问题**
56
+ - 当 story 内容过多或嵌套层级过深时,可能会导致 Storybook 卡死。这通常是复杂组件的 story 出现逻辑问题时导致的,但 Storybook 无法抛出明确的错误信息。建议检查自己新增的逻辑,逻辑中的错误会导致原本嵌套很深的组件造成 Storybook 页面的卡死。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lx-frontend/wrap-element-ui",
3
- "version": "1.0.24-beta.7",
3
+ "version": "1.0.25",
4
4
  "description": "wrap-element-ui",
5
5
  "author": "",
6
6
  "main": "src/components/index.ts",
@@ -5,7 +5,7 @@ import {
5
5
  IColumnConfig,
6
6
  IEmits,
7
7
  IFilterInput,
8
- IFilterSolt,
8
+ IFilterSlot,
9
9
  IProps
10
10
  } from '../types';
11
11
 
@@ -106,7 +106,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
106
106
  ? _sortable.some(v => v.prop === sortProp.value)
107
107
  : sortProp.value === prop
108
108
 
109
- return currentFilterActive || isUseSort|| summaryList.value.includes(prop);
109
+ return currentFilterActive || isUseSort || summaryList.value.includes(prop);
110
110
  }
111
111
 
112
112
  const handleHeaderPopoverShow = (column: IColumnConfig) => {
@@ -146,7 +146,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
146
146
 
147
147
  const processFilter = (filters: FilterListType) => {
148
148
  filters
149
- .filter((item): item is Exclude<FilterItem, IFilterSolt> => item.type !== 'slot')
149
+ .filter((item): item is Exclude<FilterItem, IFilterSlot> => item.type !== 'slot')
150
150
  .forEach((item) => {
151
151
  if (item.type === 'doubleDatePicker' || item.type === 'monthDayPicker') {
152
152
  const [start, end] = item.prop
@@ -184,7 +184,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
184
184
  const inputFilters = (column.filters ?? []).filter(
185
185
  (item): item is IFilterInput => item.type === 'input'
186
186
  );
187
-
187
+
188
188
  const hasValidatorError = inputFilters.some(
189
189
  (item) => item.validator
190
190
  && !item.validator((tempFilteredValue.value[item.prop] as string).trim())
@@ -248,9 +248,9 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
248
248
  }
249
249
  }
250
250
 
251
- function handleResetFilterValue (column: IColumnConfig) {
251
+ function handleResetFilterValue(column: IColumnConfig) {
252
252
  (column.filters || [])
253
- .filter((item): item is Exclude<FilterItem, IFilterSolt> => item.type !== 'slot')
253
+ .filter((item): item is Exclude<FilterItem, IFilterSlot> => item.type !== 'slot')
254
254
  .forEach(
255
255
  (item) => {
256
256
  if (item.type === 'radio' || item.type === 'checkbox') {
@@ -296,7 +296,7 @@ export function useColumnHeaderOperation({ props, tableDomRef, emit, showingColu
296
296
  // 设置搜索和过滤参数时,如果使用 showingColumns 遍历,会导致通过外部设置未显示的列的搜索和过滤参数丢失
297
297
  [props.colorFilterConfig, ...props.columnConfig].forEach(column => {
298
298
  (column?.filters ?? [])
299
- .filter((item): item is Exclude<FilterItem, IFilterSolt> => item.type !== 'slot')
299
+ .filter((item): item is Exclude<FilterItem, IFilterSlot> => item.type !== 'slot')
300
300
  .forEach(
301
301
  (item) => {
302
302
  if (item.type === 'doubleDatePicker' || item.type === 'monthDayPicker') {
@@ -66,7 +66,8 @@ export function useViewSetting({
66
66
  await nextTick()
67
67
 
68
68
  const settingStorgeMigrationConfigs = props.settingStorgeMigrationConfigs ?? []
69
- const version = settingStorgeMigrationConfigs.length ? settingStorgeMigrationConfigs[settingStorgeMigrationConfigs.length - 1].version.to : undefined
69
+ const len = settingStorgeMigrationConfigs.length
70
+ const version = len ? settingStorgeMigrationConfigs[len - 1].version.to : undefined
70
71
 
71
72
  localStorage.setItem(storageKey.value, JSON.stringify({
72
73
  config: {
@@ -154,11 +155,12 @@ export function useViewSetting({
154
155
  const cache = handleMigration(JSON.parse(_cache)) as SettingStorgeConfig;
155
156
 
156
157
  updateShowingColumns(
157
- Object.entries(cache.config.fields)
158
- .filter(v => !v[1].hidden)
159
- .sort((a, b) => a[1].order - b[1].order)
160
- .map(v => v[0])
161
- )
158
+ val.filter(v => {
159
+ return cache.config.fields[v.prop] ? !cache.config.fields[v.prop].hidden : !v.defaultHide
160
+ }).sort((a, b) => {
161
+ return (cache.config.fields[a.prop]?.order ?? 0) - (cache.config.fields[b.prop]?.order ?? 0)
162
+ }).map(v => v.prop)
163
+ );
162
164
 
163
165
  const _leftFixedColumnCount = Number(cache?.config?.leftFixedColumnCount)
164
166
  leftFixedColumnCount.value = isNaN(_leftFixedColumnCount) ? (props.leftFixedCount as number) : _leftFixedColumnCount;
@@ -7,8 +7,8 @@ export enum IEditType {
7
7
  }
8
8
 
9
9
  export interface ISortOption {
10
- prop: string
11
- label: string
10
+ prop: string
11
+ label: string
12
12
  }
13
13
 
14
14
  /** 筛选组件 - 输入框 */
@@ -71,13 +71,13 @@ export interface IFilterColorRadio {
71
71
  options: Array<IFilterSelectOptions & { color: string }>
72
72
  }
73
73
 
74
- export interface IFilterSolt {
74
+ export interface IFilterSlot {
75
75
  type: 'slot',
76
76
  slotName: string,
77
77
  active: () => boolean
78
78
  }
79
79
 
80
- export type FilterItem = IFilterInput | IFilterSelect | IFilterDoubleDatePicker | IFilterDoubleDatePickerLimit | IFilterMonthDayPicker | IFilterColorRadio | IFilterSolt
80
+ export type FilterItem = IFilterInput | IFilterSelect | IFilterDoubleDatePicker | IFilterDoubleDatePickerLimit | IFilterMonthDayPicker | IFilterColorRadio | IFilterSlot
81
81
 
82
82
  /** 筛选组件类型 */
83
83
  export type FilterListType = Array<FilterItem>
@@ -115,7 +115,7 @@ type IInputColumn = IColumnConfigRequired & {
115
115
  }
116
116
 
117
117
  type ISelectColumn = IColumnConfigRequired & {
118
- options: { key: string; value: string | number; [key: string]: any }[];
118
+ options: { key: string; value: string | number;[key: string]: any }[];
119
119
  }
120
120
 
121
121
  type IDateOnlyColumn = IColumnConfigRequired
@@ -3,16 +3,18 @@
3
3
  class="search-form"
4
4
  :inline="isInline"
5
5
  :label-width="width"
6
+ :label-position="labelPosition"
6
7
  >
7
8
  <el-form-item
8
9
  v-for="({
9
- isEmpty = true, key, type, prop, label, placeholder, candidate, filterable=false, withoutAll=false, collapseTags=false,
10
- clearable=false, multiple=false, multipleLimit=0, changeCb, inputLimitCallback, slotName, dateType='date',
10
+ isEmpty = true, key, type, prop, label, labelWidth, placeholder, candidate, filterable=false, withoutAll=false, collapseTags=false,
11
+ clearable=false, multiple=false, multipleLimit=0, changeCb, inputLimitCallback, slotName, dateType='date', rangeSeparator,
11
12
  doubleIsInline = true, maxlength = 255, pickerOptions, limit, required = false
12
13
  }) in config"
13
14
  :required="required"
14
15
  :key="label"
15
16
  :label="showLabel ? label : ''"
17
+ :label-width="labelWidth || width"
16
18
  style="margin-right: 10px"
17
19
  >
18
20
  <el-input
@@ -69,7 +71,7 @@
69
71
  format="yyyy-MM-dd"
70
72
  value-format="yyyy-MM-dd"
71
73
  :type="dateType"
72
- range-separator="到"
74
+ :range-separator="rangeSeparator || ''"
73
75
  :placeholder="dateType == 'date' ? placeholder || '选择日期' : '选择日期范围'"
74
76
  start-placeholder="开始日期"
75
77
  end-placeholder="结束日期"
@@ -135,6 +137,10 @@ import { genStartDateDisabledOptions, genEndDateDisabledOptions } from '../helpe
135
137
  export default {
136
138
  name: 'SearchForm',
137
139
  props: {
140
+ labelPosition: {
141
+ default: 'right',
142
+ type: String
143
+ },
138
144
  isShowSearchBtn: {
139
145
  default: true,
140
146
  type: Boolean
@@ -3,6 +3,7 @@ import { DatePicker } from "element-ui/types/element-ui"
3
3
  type BaseOption = {
4
4
  label: string
5
5
  prop: string
6
+ labelWidth?: string
6
7
  clearable?: boolean
7
8
  placeholder?: string
8
9
  key?: string
@@ -39,6 +40,7 @@ type SelectOption = BaseOption & {
39
40
  type DatePickerOption = BaseOption & {
40
41
  type: 'datePicker'
41
42
  dateType?: string
43
+ rangeSeparator?: string
42
44
  datePickerOptions?: DatePicker['pickerOptions']
43
45
  }
44
46