view-ui-plus-derive 0.1.1 → 0.1.3

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
@@ -1,6 +1,7 @@
1
1
  # view-ui-plus-derive
2
2
 
3
- 基于vue 3.5+与view-ui-plus的组件&优化扩展等
3
+ 基于vue 3.5+与view-ui-plus的组件&优化扩展等,支持自定义组件名前缀
4
+ **示例均使用无前缀的默认组件名**
4
5
 
5
6
  ## 安装
6
7
 
@@ -44,6 +45,43 @@ import App from './App.vue'
44
45
  createApp(App).use(ViewUIPlus).use(iviewDerive).mount('#app')
45
46
  ```
46
47
 
48
+ #### 自定义组件名前缀
49
+
50
+ 为免容易变得冗长,组件名及其样式class默认无前缀,若需要自定义,可传入prefix参数
51
+ 该参数通过全局provide提供以便访问,对应的key为 `Symbol('vupdPrefix')` ,不会与其它全局provide冲突
52
+
53
+ ```js
54
+ import { createApp } from 'vue'
55
+ import ViewUIPlus from 'view-ui-plus'
56
+ import 'view-ui-plus/dist/styles/viewuiplus.css'
57
+ import iviewDerive from 'view-ui-plus-derive' // 包含所有组件与指令
58
+
59
+ import App from './App.vue'
60
+
61
+ createApp(App)
62
+ .use(ViewUIPlus)
63
+ // 所有组件名前缀将被设置为 My,使用时如 <MyCombi>,<MyBaseSwitch> ...
64
+ .use(iviewDerive, { prefix: 'My' })
65
+ .mount('#app')
66
+ ```
67
+
68
+ **此时需要再修改组件共用的less变量以适配前缀**,无需前缀时建议直接引入`view-ui-plus-derive/style`中的css
69
+ `App.vue`
70
+
71
+ ```less
72
+ <style lang="less">
73
+ // 引入组件less则必须同时引入common.less,导入后并覆盖变量@vupd-prefix为需要的前缀名称
74
+ @import 'view-ui-plus-derive/less/common.less';
75
+ @vupd-prefix: 'my';
76
+
77
+ // 导入所有组件样式
78
+ @import 'view-ui-plus-derive/less/index.less';
79
+
80
+ // 或者单独导入需要的组件样式
81
+ @import 'view-ui-plus-derive/less/Combi.less';
82
+ </style>
83
+ ```
84
+
47
85
  ### 按需引入
48
86
 
49
87
  ```js
@@ -1512,8 +1550,11 @@ action()
1512
1550
  v-model:loading="pageTable.loading"
1513
1551
  :columns="pageTable.columns"
1514
1552
  :method="getList"
1515
- data-key="ress"
1553
+ page-key="current"
1554
+ size-key="size"
1555
+ data-key="list"
1516
1556
  total-key="total"
1557
+ use-page-num
1517
1558
  :max-height="400"
1518
1559
  show-header
1519
1560
  border
@@ -1630,12 +1671,6 @@ pageMap: {
1630
1671
  // 处理接口返回列表数据的函数
1631
1672
  process: Function
1632
1673
 
1633
- // 自动设置Table的maxHeight
1634
- autoMaxHeight: {
1635
- type: Boolean,
1636
- default: true
1637
- }
1638
-
1639
1674
  // 是否本地分页
1640
1675
  isLocal: Boolean
1641
1676
 
@@ -1657,9 +1692,6 @@ bottomDis: {
1657
1692
  default: 80
1658
1693
  }
1659
1694
 
1660
- // Table的maxHeight
1661
- maxHeight: [Number, String]
1662
-
1663
1695
  border: Boolean
1664
1696
 
1665
1697
  // v-model:selection获取勾选项
@@ -1697,6 +1729,27 @@ fullscreen: Boolean
1697
1729
 
1698
1730
  // 传至ToggleColumn组件的storeAt
1699
1731
  storeAt: String
1732
+
1733
+ // 自动设置Table的maxHeight
1734
+ autoMaxHeight: {
1735
+ type: Boolean,
1736
+ default: true
1737
+ }
1738
+
1739
+ // Table的maxHeight
1740
+ maxHeight: [Number, String]
1741
+
1742
+ // Table的height
1743
+ height: [Number, String]
1744
+
1745
+ // 自动设置Table的height
1746
+ autoHeight: Boolean
1747
+
1748
+ // 最大化时自动计算哪种高度
1749
+ maximizeHeightType: {
1750
+ type: String as PropType<'height' | 'maxHeight'>,
1751
+ default: 'maxHeight'
1752
+ }
1700
1753
  ```
1701
1754
 
1702
1755
  **emits**
@@ -1709,6 +1762,11 @@ storeAt: String
1709
1762
  */
1710
1763
  emit('load', res)
1711
1764
 
1765
+ /**
1766
+ * 点击刷新图标触发,仅本地分页时生效
1767
+ */
1768
+ emit('reload')
1769
+
1712
1770
  /**
1713
1771
  * 勾选项变更后触发
1714
1772
  * @param selections 勾选项
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ import { OnCleanup } from '@vue/reactivity';
19
19
  import { PropType } from 'vue';
20
20
  import { PublicProps } from 'vue';
21
21
  import { Ref } from 'vue';
22
+ import { ShallowReactive } from 'vue';
22
23
  import { ShallowUnwrapRef } from 'vue';
23
24
  import { Slot } from 'vue';
24
25
  import { VNodeProps } from 'vue';
@@ -1432,6 +1433,7 @@ declare const _default: {
1432
1433
  export default _default;
1433
1434
 
1434
1435
  export declare function install(app: App, opt?: {
1436
+ prefix?: string;
1435
1437
  i18n?: any;
1436
1438
  msg?: Obj;
1437
1439
  msgPrefix?: string;
@@ -1877,13 +1879,6 @@ border: BooleanConstructor;
1877
1879
  */
1878
1880
  process: FunctionConstructor;
1879
1881
  /**
1880
- * 自动设置Table的maxHeight
1881
- */
1882
- autoMaxHeight: {
1883
- type: BooleanConstructor;
1884
- default: boolean;
1885
- };
1886
- /**
1887
1882
  * 是否本地分页
1888
1883
  */
1889
1884
  isLocal: BooleanConstructor;
@@ -1900,17 +1895,13 @@ default: () => number[];
1900
1895
  autoRemain: BooleanConstructor;
1901
1896
  /**
1902
1897
  * 计算Table的maxHeight时,Table距离视口底部的距离
1903
- * @default 80
1898
+ * @default 45
1904
1899
  */
1905
1900
  bottomDis: {
1906
1901
  type: (NumberConstructor | StringConstructor)[];
1907
1902
  default: number;
1908
1903
  };
1909
1904
  /**
1910
- * Table的maxHeight
1911
- */
1912
- maxHeight: (NumberConstructor | StringConstructor)[];
1913
- /**
1914
1905
  * 勾选项
1915
1906
  */
1916
1907
  selection: ArrayConstructor;
@@ -1954,14 +1945,45 @@ fullscreen: BooleanConstructor;
1954
1945
  * 传至ToggleColumn组件的storeAt
1955
1946
  */
1956
1947
  storeAt: StringConstructor;
1948
+ /**
1949
+ * 隐藏分页
1950
+ */
1951
+ hidePage: BooleanConstructor;
1952
+ /**
1953
+ * 自动设置Table的maxHeight
1954
+ */
1955
+ autoMaxHeight: {
1956
+ type: BooleanConstructor;
1957
+ default: boolean;
1958
+ };
1959
+ /**
1960
+ * Table的maxHeight
1961
+ */
1962
+ maxHeight: (NumberConstructor | StringConstructor)[];
1963
+ /**
1964
+ * Table的height
1965
+ */
1966
+ height: (NumberConstructor | StringConstructor)[];
1967
+ /**
1968
+ * 自动设置Table的height
1969
+ */
1970
+ autoHeight: BooleanConstructor;
1971
+ /**
1972
+ * 最大化时自动计算哪种高度
1973
+ */
1974
+ maximizeHeightType: {
1975
+ type: PropType<"height" | "maxHeight">;
1976
+ default: string;
1977
+ };
1957
1978
  loading: {
1958
1979
  type: PropType<boolean>;
1959
1980
  };
1960
1981
  }>, {
1961
1982
  search: (stay?: boolean) => void;
1962
- setMaxHeight: () => void;
1983
+ setMaxHeight: (isHeight?: boolean) => void;
1963
1984
  table: {
1964
1985
  data: Obj[];
1986
+ height: string | number | undefined;
1965
1987
  maxHeight: string | number | undefined;
1966
1988
  selectType: {
1967
1989
  align: string;
@@ -1970,6 +1992,11 @@ renderHeader: (h: any) => false | JSX.Element;
1970
1992
  render: (h: any, { row, index }: Obj) => any;
1971
1993
  };
1972
1994
  };
1995
+ sizer: ShallowReactive< {
1996
+ curr: number;
1997
+ size: number;
1998
+ total: number;
1999
+ }>;
1973
2000
  getPage: () => {
1974
2001
  curr: number;
1975
2002
  total: number;
@@ -2052,13 +2079,6 @@ border: BooleanConstructor;
2052
2079
  */
2053
2080
  process: FunctionConstructor;
2054
2081
  /**
2055
- * 自动设置Table的maxHeight
2056
- */
2057
- autoMaxHeight: {
2058
- type: BooleanConstructor;
2059
- default: boolean;
2060
- };
2061
- /**
2062
2082
  * 是否本地分页
2063
2083
  */
2064
2084
  isLocal: BooleanConstructor;
@@ -2075,17 +2095,13 @@ default: () => number[];
2075
2095
  autoRemain: BooleanConstructor;
2076
2096
  /**
2077
2097
  * 计算Table的maxHeight时,Table距离视口底部的距离
2078
- * @default 80
2098
+ * @default 45
2079
2099
  */
2080
2100
  bottomDis: {
2081
2101
  type: (NumberConstructor | StringConstructor)[];
2082
2102
  default: number;
2083
2103
  };
2084
2104
  /**
2085
- * Table的maxHeight
2086
- */
2087
- maxHeight: (NumberConstructor | StringConstructor)[];
2088
- /**
2089
2105
  * 勾选项
2090
2106
  */
2091
2107
  selection: ArrayConstructor;
@@ -2129,6 +2145,36 @@ fullscreen: BooleanConstructor;
2129
2145
  * 传至ToggleColumn组件的storeAt
2130
2146
  */
2131
2147
  storeAt: StringConstructor;
2148
+ /**
2149
+ * 隐藏分页
2150
+ */
2151
+ hidePage: BooleanConstructor;
2152
+ /**
2153
+ * 自动设置Table的maxHeight
2154
+ */
2155
+ autoMaxHeight: {
2156
+ type: BooleanConstructor;
2157
+ default: boolean;
2158
+ };
2159
+ /**
2160
+ * Table的maxHeight
2161
+ */
2162
+ maxHeight: (NumberConstructor | StringConstructor)[];
2163
+ /**
2164
+ * Table的height
2165
+ */
2166
+ height: (NumberConstructor | StringConstructor)[];
2167
+ /**
2168
+ * 自动设置Table的height
2169
+ */
2170
+ autoHeight: BooleanConstructor;
2171
+ /**
2172
+ * 最大化时自动计算哪种高度
2173
+ */
2174
+ maximizeHeightType: {
2175
+ type: PropType<"height" | "maxHeight">;
2176
+ default: string;
2177
+ };
2132
2178
  loading: {
2133
2179
  type: PropType<boolean>;
2134
2180
  };
@@ -2155,13 +2201,17 @@ clickToCheck: boolean;
2155
2201
  pure: boolean;
2156
2202
  showHeader: boolean;
2157
2203
  fullscreen: boolean;
2204
+ hidePage: boolean;
2205
+ autoHeight: boolean;
2158
2206
  pageMap: Record<string, any>;
2159
- autoMaxHeight: boolean;
2160
2207
  pageSizeOpts: number[];
2161
2208
  bottomDis: string | number;
2209
+ autoMaxHeight: boolean;
2210
+ maximizeHeightType: "height" | "maxHeight";
2162
2211
  }, {}, {}, {}, string, ComponentProvideOptions, true, {
2163
2212
  elRef: HTMLDivElement;
2164
2213
  tableRef: unknown;
2214
+ pageRef: unknown;
2165
2215
  }, HTMLDivElement>, Partial<Record<any, (_: any) => any>> & {
2166
2216
  title?(_: {}): any;
2167
2217
  headerAction?(_: {}): any;