ebaoferc 0.0.3-beta.5 → 0.0.3-beta.6

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.
@@ -0,0 +1,11 @@
1
+ import { ReactElement } from 'react';
2
+ import './index.less';
3
+ export type TSectionTitleBarProps = {
4
+ title: string;
5
+ titleSize?: string;
6
+ showDivider?: boolean;
7
+ centerTools?: ReactElement;
8
+ rightTools?: ReactElement;
9
+ };
10
+ export type TSectionTitleBarRef = object;
11
+ export declare const SectionTitleBar: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<TSectionTitleBarProps & import("react").RefAttributes<object>>>;
@@ -0,0 +1,51 @@
1
+ import { Divider, Typography } from 'antd';
2
+ import { forwardRef, memo, useImperativeHandle } from 'react';
3
+ import "./index.less";
4
+ // import { TSectionTitleBarStyledProps } from './styled';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { Fragment as _Fragment } from "react/jsx-runtime";
8
+ var SectionTitleBarCpn = function SectionTitleBarCpn(props, ref) {
9
+ var title = props.title,
10
+ _props$titleSize = props.titleSize,
11
+ titleSize = _props$titleSize === void 0 ? '16px' : _props$titleSize,
12
+ _props$showDivider = props.showDivider,
13
+ showDivider = _props$showDivider === void 0 ? true : _props$showDivider,
14
+ centerTools = props.centerTools,
15
+ rightTools = props.rightTools;
16
+ useImperativeHandle(ref, function () {
17
+ return {};
18
+ });
19
+ var dividerMarginButtom = '12px';
20
+ return /*#__PURE__*/_jsxs(_Fragment, {
21
+ children: [/*#__PURE__*/_jsxs("div", {
22
+ className: "section-title-bar",
23
+ style: {
24
+ marginBottom: showDivider ? undefined : dividerMarginButtom
25
+ },
26
+ children: [/*#__PURE__*/_jsx("div", {
27
+ className: "title-wrapper",
28
+ children: /*#__PURE__*/_jsx(Typography.Text, {
29
+ style: {
30
+ fontSize: titleSize
31
+ },
32
+ ellipsis: {
33
+ tooltip: title
34
+ },
35
+ children: title
36
+ })
37
+ }), /*#__PURE__*/_jsx("div", {
38
+ className: "center-tools",
39
+ children: centerTools
40
+ }), /*#__PURE__*/_jsx("div", {
41
+ className: "right-tools",
42
+ children: rightTools
43
+ })]
44
+ }), showDivider && /*#__PURE__*/_jsx(Divider, {
45
+ style: {
46
+ margin: "8px 0px ".concat(dividerMarginButtom)
47
+ }
48
+ })]
49
+ });
50
+ };
51
+ export var SectionTitleBar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(SectionTitleBarCpn));
@@ -0,0 +1,31 @@
1
+ .section-title-bar {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 8px;
5
+ margin-bottom: 0;
6
+
7
+ .title-wrapper {
8
+ overflow: hidden;
9
+ // text-overflow: ellipsis;
10
+ // white-space: nowrap;
11
+
12
+ font-size: 16px;
13
+ font-weight: bold;
14
+ }
15
+
16
+ .center-tools {
17
+ flex-grow: 1;
18
+ display: flex;
19
+ align-items: center;
20
+ flex-wrap: wrap;
21
+ gap: 8px;
22
+ }
23
+
24
+ .right-tools {
25
+ display: flex;
26
+ align-items: center;
27
+ flex-shrink: 0;
28
+ // flex-wrap: wrap;
29
+ gap: 8px;
30
+ }
31
+ }
@@ -1,6 +1,7 @@
1
1
  export { default as FlexRowCol } from './FlexRowCol';
2
+ export * from './MindGraph';
3
+ export * from './SectionTitleBar';
2
4
  export { default as SliderVerify } from './SliderVerify';
3
5
  export { default as StyledQueryFilter } from './StyledQueryFilter';
4
6
  export { default as StyledTable } from './StyledTable';
5
7
  export { default as TabSearchTools } from './TabSearchTools';
6
- export * from './MindGraph';
@@ -1,6 +1,7 @@
1
1
  export { default as FlexRowCol } from "./FlexRowCol";
2
+ export * from "./MindGraph";
3
+ export * from "./SectionTitleBar";
2
4
  export { default as SliderVerify } from "./SliderVerify";
3
5
  export { default as StyledQueryFilter } from "./StyledQueryFilter";
4
6
  export { default as StyledTable } from "./StyledTable";
5
- export { default as TabSearchTools } from "./TabSearchTools";
6
- export * from "./MindGraph";
7
+ export { default as TabSearchTools } from "./TabSearchTools";
@@ -0,0 +1,6 @@
1
+ import { Data, PaginationOptions, PaginationResult, Params, Service } from 'ahooks/lib/usePagination/types';
2
+ export declare function useEnhancePagination<TData extends Data, TParams extends Params>(service: Service<TData, TParams>, options?: PaginationOptions<TData, TParams> & {
3
+ dataPropPath?: string;
4
+ }): PaginationResult<TData, TParams> & {
5
+ listData: Array<any>;
6
+ };
@@ -0,0 +1,39 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { usePagination } from 'ahooks';
8
+ import { isNullOrUndefined } from "../../utils";
9
+ import { useMemo } from 'react';
10
+ var getPropByPath = function getPropByPath(target, path) {
11
+ var pathArr = path.split('.');
12
+ var deep = function deep(current, path) {
13
+ if ((path === null || path === void 0 ? void 0 : path.length) === 1) return current === null || current === void 0 ? void 0 : current[path === null || path === void 0 ? void 0 : path[0]];
14
+ return deep(current === null || current === void 0 ? void 0 : current[path === null || path === void 0 ? void 0 : path[0]], path.slice(1));
15
+ };
16
+ return deep(target, pathArr);
17
+ };
18
+ export function useEnhancePagination(service, options) {
19
+ var _ref = options !== null && options !== void 0 ? options : {},
20
+ _ref$dataPropPath = _ref.dataPropPath,
21
+ dataPropPath = _ref$dataPropPath === void 0 ? 'data' : _ref$dataPropPath;
22
+ var paginationHookRes = usePagination(service, _objectSpread(_objectSpread({}, options), {}, {
23
+ onSuccess: function onSuccess(result, args) {
24
+ var _options$onSuccess;
25
+ if (!isNullOrUndefined(options === null || options === void 0 ? void 0 : options.onSuccess)) options === null || options === void 0 || (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 || _options$onSuccess.call(options, result, args);
26
+ var data = getPropByPath(result, dataPropPath);
27
+ var params = args === null || args === void 0 ? void 0 : args[0];
28
+ if (!(data !== null && data !== void 0 && data.length) && (params === null || params === void 0 ? void 0 : params.current) > 1) paginationHookRes.pagination.changeCurrent((params === null || params === void 0 ? void 0 : params.current) - 1);
29
+ }
30
+ }));
31
+ var listData = useMemo(function () {
32
+ var _getPropByPath, _paginationHookRes$da, _getPropByPath2, _paginationHookRes$da2;
33
+ console.log('listData', (_getPropByPath = getPropByPath((_paginationHookRes$da = paginationHookRes.data) !== null && _paginationHookRes$da !== void 0 ? _paginationHookRes$da : {}, dataPropPath)) !== null && _getPropByPath !== void 0 ? _getPropByPath : []);
34
+ return (_getPropByPath2 = getPropByPath((_paginationHookRes$da2 = paginationHookRes.data) !== null && _paginationHookRes$da2 !== void 0 ? _paginationHookRes$da2 : {}, dataPropPath)) !== null && _getPropByPath2 !== void 0 ? _getPropByPath2 : [];
35
+ }, [paginationHookRes.data, dataPropPath]);
36
+ return _objectSpread({
37
+ listData: listData
38
+ }, paginationHookRes);
39
+ }
@@ -3,6 +3,10 @@ type AliasMap<T> = {
3
3
  };
4
4
  export declare function resolveAlias<T>(obj: T, aliasMap: AliasMap<T>): Partial<T>;
5
5
  export declare function isNullOrUndefined(target: any): boolean;
6
+ /**
7
+ * 给对象第一层的字符串属性值做 trim
8
+ */
9
+ export declare function trimObjectValuesFirstLayer<T extends Record<string, any>>(obj: T): T;
6
10
  interface Pagination {
7
11
  total: number;
8
12
  current: number;
@@ -13,6 +13,19 @@ export function resolveAlias(obj, aliasMap) {
13
13
  export function isNullOrUndefined(target) {
14
14
  return target === null || target === undefined;
15
15
  }
16
+
17
+ /**
18
+ * 给对象第一层的字符串属性值做 trim
19
+ */
20
+ export function trimObjectValuesFirstLayer(obj) {
21
+ var result = {};
22
+ for (var _key2 in obj) {
23
+ if (obj.hasOwnProperty(_key2)) {
24
+ result[_key2] = typeof obj[_key2] === 'string' ? obj[_key2].trim() : obj[_key2];
25
+ }
26
+ }
27
+ return result;
28
+ }
16
29
  /**
17
30
  * 表格序号
18
31
  * @param TableRiwNoType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ebaoferc",
3
- "version": "0.0.3-beta.5",
3
+ "version": "0.0.3-beta.6",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",