@arim-aisdc/public-components 2.0.13 → 2.0.15

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.
@@ -17,7 +17,7 @@ export declare const foramtBaseInfoField: (data: any, dataField: BaseInfoFieldTy
17
17
  value: any;
18
18
  field: string;
19
19
  label?: string;
20
- text: string | JSX.Element | Element;
20
+ text: string | Element | JSX.Element;
21
21
  units?: string;
22
22
  width?: string;
23
23
  labelWidth?: string;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { VariablesJsonType } from './type';
3
+ import { ThemeType } from "../../../dist/components/ThemeProvider";
3
4
  export interface ConfigConsumerProps {
4
5
  userId?: string;
5
6
  tableKeyPrefixCls?: string;
@@ -12,7 +13,7 @@ export interface ConfigConsumerProps {
12
13
  /**项目根节名称 */
13
14
  root?: string;
14
15
  /** 空数据图标组件 */
15
- renderEmpty?: () => React.ReactNode;
16
+ renderEmpty?: (theme?: ThemeType) => React.ReactNode;
16
17
  }
17
18
  export declare const DEFAULT_CONTEXT: {
18
19
  theme: string;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export type IconType = 'colours' | 'gray';
3
+ export type IconProps = {
4
+ type?: IconType;
5
+ name?: string;
6
+ prefix?: string;
7
+ };
8
+ declare const IconDemo: React.FC<IconProps>;
9
+ export default IconDemo;
@@ -0,0 +1,22 @@
1
+ import { Icon } from "../../..";
2
+ import React from 'react';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ import { Fragment as _Fragment } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ var IconDemo = function IconDemo() {
7
+ return /*#__PURE__*/_jsxs(_Fragment, {
8
+ children: [/*#__PURE__*/_jsx("h5", {
9
+ children: "\u5355\u8272\u56FE\u6807"
10
+ }), /*#__PURE__*/_jsx(Icon, {
11
+ prefix: "gray",
12
+ name: "hebingjiaoci"
13
+ }), /*#__PURE__*/_jsx("h5", {
14
+ children: "\u5F69\u8272\u56FE\u6807"
15
+ }), /*#__PURE__*/_jsx(Icon, {
16
+ type: "colours",
17
+ prefix: "",
18
+ name: ""
19
+ })]
20
+ });
21
+ };
22
+ export default IconDemo;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export type IconType = 'colours' | 'gray';
3
+ export type IconProps = {
4
+ type?: IconType;
5
+ name?: string;
6
+ prefix?: string;
7
+ };
8
+ declare const Icon: React.FC<IconProps>;
9
+ export default Icon;
@@ -0,0 +1,20 @@
1
+ import React, { useMemo } from 'react';
2
+ import { useConfig } from "../ConfigProvider";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ var Icon = function Icon(_ref) {
5
+ var _ref$type = _ref.type,
6
+ type = _ref$type === void 0 ? 'gray' : _ref$type,
7
+ name = _ref.name,
8
+ prefix = _ref.prefix;
9
+ var _useConfig = useConfig(),
10
+ theme = _useConfig.theme;
11
+ var iconPrefix = useMemo(function () {
12
+ if (type === 'gray') return prefix;
13
+ if (type === 'colours') return "".concat(prefix, "-").concat(theme);
14
+ return undefined;
15
+ }, [theme]);
16
+ return /*#__PURE__*/_jsx("i", {
17
+ className: "iconfont-".concat(iconPrefix, " icon-").concat(iconPrefix, "-").concat(name)
18
+ });
19
+ };
20
+ export default Icon;
@@ -50,7 +50,8 @@ var QueryFilter = function QueryFilter(_ref, ref) {
50
50
  var _Form$useForm = Form.useForm(),
51
51
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
52
52
  form = _Form$useForm2[0];
53
- var Option = Select.Option;
53
+ var Option = Select.Option,
54
+ OptGroup = Select.OptGroup;
54
55
  var RangePicker = DatePicker.RangePicker;
55
56
  var _useState = useState({}),
56
57
  _useState2 = _slicedToArray(_useState, 2),
@@ -229,17 +230,37 @@ var QueryFilter = function QueryFilter(_ref, ref) {
229
230
  optionFilterProp: item.optionFilterProp || 'value',
230
231
  optionLabelProp: item.optionLabelProp || 'children',
231
232
  children: item.setting.map(function (el, num) {
232
- var _item$fieldNames, _item$fieldNames2, _item$fieldNames3, _item$fieldNames4;
233
- var value = item !== null && item !== void 0 && (_item$fieldNames = item.fieldNames) !== null && _item$fieldNames !== void 0 && _item$fieldNames.value ? el[item === null || item === void 0 || (_item$fieldNames2 = item.fieldNames) === null || _item$fieldNames2 === void 0 ? void 0 : _item$fieldNames2.value] : el.value;
234
- var label = item !== null && item !== void 0 && (_item$fieldNames3 = item.fieldNames) !== null && _item$fieldNames3 !== void 0 && _item$fieldNames3.label ? el[item === null || item === void 0 || (_item$fieldNames4 = item.fieldNames) === null || _item$fieldNames4 === void 0 ? void 0 : _item$fieldNames4.label] : el.label;
235
- return /*#__PURE__*/_jsx(Option, {
236
- value: value,
237
- label: label,
238
- children: el.color ? /*#__PURE__*/_jsx(Badge, {
239
- color: el.color,
240
- text: label
241
- }) : label
242
- }, num);
233
+ var _el$options;
234
+ if (el !== null && el !== void 0 && el.options && (el === null || el === void 0 || (_el$options = el.options) === null || _el$options === void 0 ? void 0 : _el$options.length) > 0) {
235
+ return /*#__PURE__*/_jsx(OptGroup, {
236
+ label: el.label,
237
+ children: el.options.map(function (el2) {
238
+ var _item$fieldNames, _item$fieldNames2, _item$fieldNames3, _item$fieldNames4;
239
+ var value = item !== null && item !== void 0 && (_item$fieldNames = item.fieldNames) !== null && _item$fieldNames !== void 0 && _item$fieldNames.value ? el2[item === null || item === void 0 || (_item$fieldNames2 = item.fieldNames) === null || _item$fieldNames2 === void 0 ? void 0 : _item$fieldNames2.value] : el2.value;
240
+ var label = item !== null && item !== void 0 && (_item$fieldNames3 = item.fieldNames) !== null && _item$fieldNames3 !== void 0 && _item$fieldNames3.label ? el2[item === null || item === void 0 || (_item$fieldNames4 = item.fieldNames) === null || _item$fieldNames4 === void 0 ? void 0 : _item$fieldNames4.label] : el2.label;
241
+ return /*#__PURE__*/_jsx(Option, {
242
+ value: value,
243
+ label: label,
244
+ children: el2.color ? /*#__PURE__*/_jsx(Badge, {
245
+ color: el2.color,
246
+ text: label
247
+ }) : label
248
+ }, value);
249
+ })
250
+ }, num);
251
+ } else {
252
+ var _item$fieldNames5, _item$fieldNames6, _item$fieldNames7, _item$fieldNames8;
253
+ var value = item !== null && item !== void 0 && (_item$fieldNames5 = item.fieldNames) !== null && _item$fieldNames5 !== void 0 && _item$fieldNames5.value ? el[item === null || item === void 0 || (_item$fieldNames6 = item.fieldNames) === null || _item$fieldNames6 === void 0 ? void 0 : _item$fieldNames6.value] : el.value;
254
+ var label = item !== null && item !== void 0 && (_item$fieldNames7 = item.fieldNames) !== null && _item$fieldNames7 !== void 0 && _item$fieldNames7.label ? el[item === null || item === void 0 || (_item$fieldNames8 = item.fieldNames) === null || _item$fieldNames8 === void 0 ? void 0 : _item$fieldNames8.label] : el.label;
255
+ return /*#__PURE__*/_jsx(Option, {
256
+ value: value,
257
+ label: label,
258
+ children: el.color ? /*#__PURE__*/_jsx(Badge, {
259
+ color: el.color,
260
+ text: label
261
+ }) : label
262
+ }, num);
263
+ }
243
264
  })
244
265
  });
245
266
  break;
@@ -231,7 +231,7 @@ var TableBody = function TableBody(_ref) {
231
231
  children: loading ? /*#__PURE__*/_jsx(Spin, {}) : /*#__PURE__*/_jsx("span", {
232
232
  className: "empty-content",
233
233
  ref: dropRef,
234
- children: renderEmpty ? renderEmpty() : /*#__PURE__*/_jsxs(_Fragment, {
234
+ children: renderEmpty ? renderEmpty(theme) : /*#__PURE__*/_jsxs(_Fragment, {
235
235
  children: [/*#__PURE__*/_jsx("img", {
236
236
  className: "empty-img",
237
237
  src: theme === 'dark' ? DataEmptyDarkPng : DataEmptyLightPng
@@ -1,13 +1,13 @@
1
1
  import { TableMaxColumnType } from "../../type";
2
- export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
3
- export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
4
- export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
5
- export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
2
+ export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
3
+ export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
4
+ export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
5
+ export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
6
6
  declare const customSortFns: {
7
- numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
8
- stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
9
- timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
10
- numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
7
+ numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
8
+ stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
9
+ timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
10
+ numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
11
11
  };
12
12
  export default customSortFns;
13
13
  export type SortFnType = keyof typeof customSortFns | undefined;
package/dist/index.d.ts CHANGED
@@ -29,6 +29,8 @@ export { default as ConditionExpression } from './components/ConditionExpression
29
29
  export * from './components/ConfigProvider';
30
30
  export * from './components/Filter';
31
31
  export { default as SchemaForm } from './components/SchemaForm';
32
+ export * from './components/Icon';
33
+ export { default as Icon } from './components/Icon';
32
34
  export { default as useCenterModalState } from './hooks/useCenterModalState';
33
35
  export * from './hooks/useEventBus';
34
36
  export { default as useEventBus } from './hooks/useEventBus';
package/dist/index.js CHANGED
@@ -30,6 +30,8 @@ export { default as ConditionExpression } from "./components/ConditionExpression
30
30
  export * from "./components/ConfigProvider";
31
31
  export * from "./components/Filter";
32
32
  export { default as SchemaForm } from "./components/SchemaForm";
33
+ export * from "./components/Icon";
34
+ export { default as Icon } from "./components/Icon";
33
35
 
34
36
  // hooks
35
37
  export { default as useCenterModalState } from "./hooks/useCenterModalState";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.0.13",
3
+ "version": "2.0.15",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",