@gx-design-vue/pro-utils 0.0.7-rc.1 → 0.0.8

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/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { isScroll, getScrollContainer, isInContainer } from './scroll';
3
3
  import scrollTo from './scroll/scrollTo';
4
4
  import getScroll from './scroll/getScroll';
5
5
  import throttleByAnimationFrame from './scroll/throttleByAnimationFrame';
6
+ export * from './slots';
6
7
  export * from './utils';
7
8
  export * from './utils/validate';
8
9
  export * from './typings';
package/dist/index.es.js CHANGED
@@ -200,6 +200,26 @@ function throttleByAnimationFrame(fn) {
200
200
  return throttled;
201
201
  }
202
202
 
203
+ function getSlot(slots, props, prop = 'default') {
204
+ if (props[prop] === false) {
205
+ return false;
206
+ }
207
+ return (props[prop] || slots[prop]);
208
+ }
209
+ function getSlotVNode(slots, props, prop = 'default') {
210
+ if (props[prop] === false) {
211
+ return false;
212
+ }
213
+ return (props[prop] || slots[prop]?.());
214
+ }
215
+ function getSlotsProps(data, slots, props) {
216
+ const renderSlotsAndProps = {};
217
+ data.forEach((name) => {
218
+ (renderSlotsAndProps)[name] = getSlotVNode(slots, props, name);
219
+ });
220
+ return renderSlotsAndProps;
221
+ }
222
+
203
223
  var global = {
204
224
  videoAllowType: [
205
225
  'mp4',
@@ -280,18 +300,6 @@ const getPrefixCls = ({ suffixCls, customizePrefixCls, isPor, className }) => {
280
300
  return customizePrefixCls;
281
301
  return suffixCls ? `${prefixCls}-${suffixCls}` : prefixCls;
282
302
  };
283
- function getSlot(slots, props, prop = 'default') {
284
- if (props[prop] === false) {
285
- return false;
286
- }
287
- return (props[prop] || slots[prop]);
288
- }
289
- function getSlotVNode(slots, props, prop = 'default') {
290
- if (props[prop] === false) {
291
- return false;
292
- }
293
- return (props[prop] || slots[prop]?.());
294
- }
295
303
  /**
296
304
  * 根据 key 和 dataIndex 生成唯一 id
297
305
  *
@@ -935,4 +943,4 @@ function off(element, event, handler, useCapture = false) {
935
943
  }
936
944
  }
937
945
 
938
- export { arrayRepeat, blobToDataURL, checkFileType, compareArray, dataURLtoBlob, dataURLtoFile, deepCopy, formatDuraton, genColumnKey, generateVidoePicture, getBase64, getBlobUrl, getFileSuffix, getLevelData, getMaxFloor, getMediaInfos, getPrefixCls, getRandomNumber, getScroll, getScrollContainer, getSlot, getSlotVNode, getSortIndex, getVideoCoverPicture, getVideoFileUrl, handleCurrentPage, handleShowIndex, hanndleField, is, isArray, isBase64, isBoolean, isFunction, isInContainer, isNumber, isObject, isScroll, isServer, isString, off, on, runFunction, scrollTo, throttleByAnimationFrame, treeData };
946
+ export { arrayRepeat, blobToDataURL, checkFileType, compareArray, dataURLtoBlob, dataURLtoFile, deepCopy, formatDuraton, genColumnKey, generateVidoePicture, getBase64, getBlobUrl, getFileSuffix, getLevelData, getMaxFloor, getMediaInfos, getPrefixCls, getRandomNumber, getScroll, getScrollContainer, getSlot, getSlotVNode, getSlotsProps, getSortIndex, getVideoCoverPicture, getVideoFileUrl, handleCurrentPage, handleShowIndex, hanndleField, is, isArray, isBase64, isBoolean, isFunction, isInContainer, isNumber, isObject, isScroll, isServer, isString, off, on, runFunction, scrollTo, throttleByAnimationFrame, treeData };
package/dist/index.js CHANGED
@@ -204,6 +204,26 @@ function throttleByAnimationFrame(fn) {
204
204
  return throttled;
205
205
  }
206
206
 
207
+ function getSlot(slots, props, prop = 'default') {
208
+ if (props[prop] === false) {
209
+ return false;
210
+ }
211
+ return (props[prop] || slots[prop]);
212
+ }
213
+ function getSlotVNode(slots, props, prop = 'default') {
214
+ if (props[prop] === false) {
215
+ return false;
216
+ }
217
+ return (props[prop] || slots[prop]?.());
218
+ }
219
+ function getSlotsProps(data, slots, props) {
220
+ const renderSlotsAndProps = {};
221
+ data.forEach((name) => {
222
+ (renderSlotsAndProps)[name] = getSlotVNode(slots, props, name);
223
+ });
224
+ return renderSlotsAndProps;
225
+ }
226
+
207
227
  var global = {
208
228
  videoAllowType: [
209
229
  'mp4',
@@ -284,18 +304,6 @@ const getPrefixCls = ({ suffixCls, customizePrefixCls, isPor, className }) => {
284
304
  return customizePrefixCls;
285
305
  return suffixCls ? `${prefixCls}-${suffixCls}` : prefixCls;
286
306
  };
287
- function getSlot(slots, props, prop = 'default') {
288
- if (props[prop] === false) {
289
- return false;
290
- }
291
- return (props[prop] || slots[prop]);
292
- }
293
- function getSlotVNode(slots, props, prop = 'default') {
294
- if (props[prop] === false) {
295
- return false;
296
- }
297
- return (props[prop] || slots[prop]?.());
298
- }
299
307
  /**
300
308
  * 根据 key 和 dataIndex 生成唯一 id
301
309
  *
@@ -961,6 +969,7 @@ exports.getScroll = getScroll;
961
969
  exports.getScrollContainer = getScrollContainer;
962
970
  exports.getSlot = getSlot;
963
971
  exports.getSlotVNode = getSlotVNode;
972
+ exports.getSlotsProps = getSlotsProps;
964
973
  exports.getSortIndex = getSortIndex;
965
974
  exports.getVideoCoverPicture = getVideoCoverPicture;
966
975
  exports.getVideoFileUrl = getVideoFileUrl;
@@ -0,0 +1,4 @@
1
+ import { Slots } from 'vue';
2
+ export declare function getSlot<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
3
+ export declare function getSlotVNode<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
4
+ export declare function getSlotsProps<T = string[], RenderSlots = any>(data: T, slots: Slots, props: Record<string, unknown>): RenderSlots;
@@ -1,4 +1,3 @@
1
- import type { Slots } from 'vue';
2
1
  import type { AlignType, ProColumn, BasicTablePageConfig, MaterialInfo } from '../typings';
3
2
  export interface prefixCls {
4
3
  suffixCls?: string;
@@ -7,8 +6,6 @@ export interface prefixCls {
7
6
  className?: string;
8
7
  }
9
8
  export declare const getPrefixCls: ({ suffixCls, customizePrefixCls, isPor, className }: prefixCls) => string;
10
- export declare function getSlot<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
11
- export declare function getSlotVNode<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
12
9
  /**
13
10
  * 根据 key 和 dataIndex 生成唯一 id
14
11
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-utils",
3
- "version": "0.0.7-rc.1",
3
+ "version": "0.0.8",
4
4
  "description": "@gx-design-vue/pro-utils",
5
5
  "license": "MIT",
6
6
  "types": "dist/index.d.ts",