@gx-design-vue/pro-utils 0.0.7 → 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
  *
@@ -924,15 +932,15 @@ function isBase64(str = '') {
924
932
  }
925
933
  return false;
926
934
  }
927
- const on = function (element, event, handler, useCapture = false) {
935
+ function on(element, event, handler, useCapture = false) {
928
936
  if (element && event && handler) {
929
937
  element.addEventListener(event, handler, useCapture);
930
938
  }
931
- };
932
- const off = function (element, event, handler, useCapture = false) {
939
+ }
940
+ function off(element, event, handler, useCapture = false) {
933
941
  if (element && event && handler) {
934
942
  element.removeEventListener(event, handler, useCapture);
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
  *
@@ -928,16 +936,16 @@ function isBase64(str = '') {
928
936
  }
929
937
  return false;
930
938
  }
931
- const on = function (element, event, handler, useCapture = false) {
939
+ function on(element, event, handler, useCapture = false) {
932
940
  if (element && event && handler) {
933
941
  element.addEventListener(event, handler, useCapture);
934
942
  }
935
- };
936
- const off = function (element, event, handler, useCapture = false) {
943
+ }
944
+ function off(element, event, handler, useCapture = false) {
937
945
  if (element && event && handler) {
938
946
  element.removeEventListener(event, handler, useCapture);
939
947
  }
940
- };
948
+ }
941
949
 
942
950
  exports.arrayRepeat = arrayRepeat;
943
951
  exports.blobToDataURL = blobToDataURL;
@@ -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
  *
@@ -207,5 +204,5 @@ export declare function generateVidoePicture(videoUrl: string, currentTime?: num
207
204
  * @description 判断是否是base64码
208
205
  */
209
206
  export declare function isBase64(str?: string): boolean;
210
- export declare const on: (element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean) => void;
211
- export declare const off: (element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean) => void;
207
+ export declare function on(element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean): void;
208
+ export declare function off(element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-utils",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "@gx-design-vue/pro-utils",
5
5
  "license": "MIT",
6
6
  "types": "dist/index.d.ts",