sun-biz 0.0.4-beta.32 → 0.0.4-beta.33

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.
@@ -1845,7 +1845,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1845
1845
  const dbgrid_component_setting_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(dbgrid_component_settingvue_type_script_setup_true_lang_tsx, [
1846
1846
  [
1847
1847
  '__scopeId',
1848
- "data-v-c49e91ea"
1848
+ "data-v-00469ccc"
1849
1849
  ]
1850
1850
  ]);
1851
1851
  /* ESM default export */ const dbgrid_component_setting = dbgrid_component_setting_exports_;
@@ -2417,6 +2417,12 @@ const SELECTION = 'selection';
2417
2417
  dragTipsClassName: {
2418
2418
  default: ''
2419
2419
  },
2420
+ settingIconWidth: {
2421
+ default: 36
2422
+ },
2423
+ columnsConfig: {
2424
+ default: ()=>[]
2425
+ },
2420
2426
  scrollLoad: {
2421
2427
  type: Function,
2422
2428
  default: void 0
@@ -2428,7 +2434,7 @@ const SELECTION = 'selection';
2428
2434
  "current-page-change",
2429
2435
  "sort-change",
2430
2436
  "scroll",
2431
- "columns-change"
2437
+ "columns-config-change"
2432
2438
  ],
2433
2439
  setup (__props, { expose: __expose, emit: __emit }) {
2434
2440
  const props = __props;
@@ -2673,6 +2679,7 @@ const SELECTION = 'selection';
2673
2679
  }));
2674
2680
  proTableRef.value?.clearSort();
2675
2681
  serveColumns.value = column;
2682
+ emit('columns-config-change', column);
2676
2683
  } catch (error) {
2677
2684
  console.log(error);
2678
2685
  }
@@ -2801,7 +2808,7 @@ const SELECTION = 'selection';
2801
2808
  ...item
2802
2809
  };
2803
2810
  });
2804
- if (!props.componentNo) return propsColumns;
2811
+ if (!(props.componentNo || serveColumns.value?.length)) return propsColumns;
2805
2812
  {
2806
2813
  let result = propsColumns.map((cur)=>({
2807
2814
  displayFlag: cur.isHidden || cur.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO ? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO : __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.YES,
@@ -2835,7 +2842,9 @@ const SELECTION = 'selection';
2835
2842
  const clientHeight = document.querySelector(`#${uuid.value} .el-table__body-wrapper`)?.clientHeight;
2836
2843
  const scrollHeight = document.querySelector(`#${uuid.value} .el-table__body`)?.scrollHeight;
2837
2844
  const threshold = props.scrollThreshold; // 距离底部80px时触发加载
2838
- if (scrollHeight - event.scrollTop - clientHeight < threshold && event.scrollTop > oldScrollTop) {
2845
+ const bottomOffset = scrollHeight - event.scrollTop - clientHeight;
2846
+ if (event.scrollTop < oldScrollTop && 0 === bottomOffset) proTableRef.value.setScrollTop(0);
2847
+ if (bottomOffset < threshold && event.scrollTop > oldScrollTop) {
2839
2848
  console.log('触发加载更多数据');
2840
2849
  props.scrollLoad();
2841
2850
  }
@@ -2851,7 +2860,7 @@ const SELECTION = 'selection';
2851
2860
  if (props.componentNo) {
2852
2861
  result = result.map((item, index)=>({
2853
2862
  ...item,
2854
- minWidth: 0 === index ? (item.minWidth || 40) + 40 : item.minWidth
2863
+ minWidth: 0 === index ? (item.minWidth || props.settingIconWidth) + props.settingIconWidth : item.minWidth
2855
2864
  }));
2856
2865
  if (exportFileFlag.value && !result.find((cur)=>cur.type === SELECTION)) result = [
2857
2866
  {
@@ -2866,8 +2875,8 @@ const SELECTION = 'selection';
2866
2875
  return result.filter((item)=>!item.isHidden && !(props.componentNo && !serveColumns.value?.length && item.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO));
2867
2876
  });
2868
2877
  // 当 componentNo 存在时,监听 tableColumns 变化,触发 columns-change 事件
2869
- if (props.componentNo) (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>tableColumns.value, (newColumns)=>{
2870
- emit('columns-change', newColumns);
2878
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.columnsConfig, (newColumnsConfig)=>{
2879
+ if (!props.componentNo && newColumnsConfig?.length) serveColumns.value = newColumnsConfig;
2871
2880
  }, {
2872
2881
  immediate: true
2873
2882
  });
package/dist/index.js CHANGED
@@ -1881,7 +1881,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1881
1881
  const dbgrid_component_setting_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(dbgrid_component_settingvue_type_script_setup_true_lang_tsx, [
1882
1882
  [
1883
1883
  '__scopeId',
1884
- "data-v-c49e91ea"
1884
+ "data-v-00469ccc"
1885
1885
  ]
1886
1886
  ]);
1887
1887
  /* ESM default export */ const dbgrid_component_setting = dbgrid_component_setting_exports_;
@@ -2453,6 +2453,12 @@ const SELECTION = 'selection';
2453
2453
  dragTipsClassName: {
2454
2454
  default: ''
2455
2455
  },
2456
+ settingIconWidth: {
2457
+ default: 36
2458
+ },
2459
+ columnsConfig: {
2460
+ default: ()=>[]
2461
+ },
2456
2462
  scrollLoad: {
2457
2463
  type: Function,
2458
2464
  default: void 0
@@ -2464,7 +2470,7 @@ const SELECTION = 'selection';
2464
2470
  "current-page-change",
2465
2471
  "sort-change",
2466
2472
  "scroll",
2467
- "columns-change"
2473
+ "columns-config-change"
2468
2474
  ],
2469
2475
  setup (__props, { expose: __expose, emit: __emit }) {
2470
2476
  const props = __props;
@@ -2709,6 +2715,7 @@ const SELECTION = 'selection';
2709
2715
  }));
2710
2716
  proTableRef.value?.clearSort();
2711
2717
  serveColumns.value = column;
2718
+ emit('columns-config-change', column);
2712
2719
  } catch (error) {
2713
2720
  console.log(error);
2714
2721
  }
@@ -2837,7 +2844,7 @@ const SELECTION = 'selection';
2837
2844
  ...item
2838
2845
  };
2839
2846
  });
2840
- if (!props.componentNo) return propsColumns;
2847
+ if (!(props.componentNo || serveColumns.value?.length)) return propsColumns;
2841
2848
  {
2842
2849
  let result = propsColumns.map((cur)=>({
2843
2850
  displayFlag: cur.isHidden || cur.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO ? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO : __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.YES,
@@ -2871,7 +2878,9 @@ const SELECTION = 'selection';
2871
2878
  const clientHeight = document.querySelector(`#${uuid.value} .el-table__body-wrapper`)?.clientHeight;
2872
2879
  const scrollHeight = document.querySelector(`#${uuid.value} .el-table__body`)?.scrollHeight;
2873
2880
  const threshold = props.scrollThreshold; // 距离底部80px时触发加载
2874
- if (scrollHeight - event.scrollTop - clientHeight < threshold && event.scrollTop > oldScrollTop) {
2881
+ const bottomOffset = scrollHeight - event.scrollTop - clientHeight;
2882
+ if (event.scrollTop < oldScrollTop && 0 === bottomOffset) proTableRef.value.setScrollTop(0);
2883
+ if (bottomOffset < threshold && event.scrollTop > oldScrollTop) {
2875
2884
  console.log('触发加载更多数据');
2876
2885
  props.scrollLoad();
2877
2886
  }
@@ -2887,7 +2896,7 @@ const SELECTION = 'selection';
2887
2896
  if (props.componentNo) {
2888
2897
  result = result.map((item, index)=>({
2889
2898
  ...item,
2890
- minWidth: 0 === index ? (item.minWidth || 40) + 40 : item.minWidth
2899
+ minWidth: 0 === index ? (item.minWidth || props.settingIconWidth) + props.settingIconWidth : item.minWidth
2891
2900
  }));
2892
2901
  if (exportFileFlag.value && !result.find((cur)=>cur.type === SELECTION)) result = [
2893
2902
  {
@@ -2902,8 +2911,8 @@ const SELECTION = 'selection';
2902
2911
  return result.filter((item)=>!item.isHidden && !(props.componentNo && !serveColumns.value?.length && item.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO));
2903
2912
  });
2904
2913
  // 当 componentNo 存在时,监听 tableColumns 变化,触发 columns-change 事件
2905
- if (props.componentNo) (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>tableColumns.value, (newColumns)=>{
2906
- emit('columns-change', newColumns);
2914
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>props.columnsConfig, (newColumnsConfig)=>{
2915
+ if (!props.componentNo && newColumnsConfig?.length) serveColumns.value = newColumnsConfig;
2907
2916
  }, {
2908
2917
  immediate: true
2909
2918
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sun-biz",
3
- "version": "0.0.4-beta.32",
3
+ "version": "0.0.4-beta.33",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  "src/*",