@lemon-fe/components 1.4.0 → 1.4.1

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.
@@ -5,10 +5,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { DatePicker } from 'antd';
8
- import React, { useEffect, useRef } from 'react';
8
+ import React, { useEffect, useMemo, useRef } from 'react';
9
9
  import { forwardRef, useImperativeHandle, useState } from 'react';
10
10
  import { editorPrefixClass, navigateCell } from "./utils";
11
11
  import EditorWrapper from "./wrapper";
12
+ import { uniq } from 'lodash';
12
13
  import moment from 'moment';
13
14
  export default /*#__PURE__*/forwardRef(function DateEditor(props, ref) {
14
15
  var _props$format = props.format,
@@ -27,6 +28,9 @@ export default /*#__PURE__*/forwardRef(function DateEditor(props, ref) {
27
28
  var elm = useRef(null);
28
29
  var isEdited = useRef(false);
29
30
  var dirty = useRef(false);
31
+ var inputFormat = useMemo(function () {
32
+ return uniq([format, 'YYYY-MM-DD', 'YYYYMMDD']);
33
+ }, []);
30
34
  useEffect(function () {
31
35
  var _elm$current;
32
36
  (_elm$current = elm.current) === null || _elm$current === void 0 || _elm$current.focus();
@@ -65,6 +69,7 @@ export default /*#__PURE__*/forwardRef(function DateEditor(props, ref) {
65
69
  className: editorPrefixClass('date'),
66
70
  value: value,
67
71
  placeholder: format,
72
+ format: inputFormat,
68
73
  onOpenChange: function onOpenChange(val) {
69
74
  if (!val) {
70
75
  isEdited.current = true;
@@ -17,7 +17,7 @@ declare const Editors: {
17
17
  Text: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("./typings").TextEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
18
18
  Date: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("./typings").DateEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
19
19
  Number: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & import("./typings").NumberEditorParams<any> & React.RefAttributes<import("ag-grid-react").ICellEditorReactComp>>;
20
- Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "allowClear" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
20
+ Select: React.ForwardRefExoticComponent<import("ag-grid-community").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "allowClear" | "mode" | "showSearch" | "optionFilterProp" | "options" | "virtual" | "listHeight"> & {
21
21
  fieldNames?: {
22
22
  label: string;
23
23
  value: string;
@@ -1,7 +1,7 @@
1
1
  var _excluded = ["validator"],
2
2
  _excluded2 = ["title", "dataIndex", "render", "ellipsis", "sorter", "editable", "className"],
3
3
  _excluded3 = ["title", "children"],
4
- _excluded4 = ["rowKey", "fetch", "dataSource", "rowActions", "columns", "autoLoad", "loading", "summary", "detailCell", "pagination", "rowSelection", "columnTypes", "defaultColDef", "components", "sideBar", "detailCellRendererParams", "context", "showSearch", "cellDisplayFlex", "locale"];
4
+ _excluded4 = ["rowKey", "fetch", "dataSource", "rowActions", "columns", "autoLoad", "loading", "summary", "detailCell", "pagination", "rowSelection", "columnTypes", "defaultColDef", "components", "sideBar", "detailCellRendererParams", "context", "showSearch", "cellDisplayFlex", "locale", "extraFooterLeft"];
5
5
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
6
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -35,7 +35,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
35
35
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
36
36
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
37
  import { Spin, Pagination } from 'antd';
38
- import React, { Component, createRef, forwardRef } from 'react';
38
+ import React, { Component, createRef, forwardRef, Fragment } from 'react';
39
39
  import { useComponentDefaultProps } from "../component-configure";
40
40
  import { useLocaleReceiver } from "../locale-receiver";
41
41
  import { parseLocalTemplate } from "../locale/locale";
@@ -543,11 +543,15 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
543
543
  if (!suppressRowClickSelection && evt.node.selectable && evt.eventPath) {
544
544
  var enableSelectionWithoutKeys = rowMultiSelectWithClick !== null && rowMultiSelectWithClick !== void 0 ? rowMultiSelectWithClick : rowSelection !== undefined && rowSelection.type !== 'radio';
545
545
  for (var i = 0; i < evt.eventPath.length; i++) {
546
+ if (evt.eventPath[i] === document.documentElement) {
547
+ break;
548
+ }
546
549
  var elm = evt.eventPath[i];
547
- if (elm.nodeName === 'A' || elm.nodeName === 'BUTTON' || elm.nodeName === 'INPUT' || elm.role === 'button' || elm.role === 'input') {
550
+ var role = elm.role || elm.getAttribute('role');
551
+ if (elm.nodeName === 'A' || elm.nodeName === 'BUTTON' || elm.nodeName === 'INPUT' || role === 'button' || role === 'input') {
548
552
  break;
549
553
  }
550
- if (elm.role === 'gridcell') {
554
+ if (role === 'gridcell') {
551
555
  if (elm.classList.contains(prefix('editor-cell'))) {
552
556
  break;
553
557
  }
@@ -1660,6 +1664,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1660
1664
  showSearch = _this$props10.showSearch,
1661
1665
  cellDisplayFlex = _this$props10.cellDisplayFlex,
1662
1666
  locale = _this$props10.locale,
1667
+ extraFooterLeft = _this$props10.extraFooterLeft,
1663
1668
  restProps = _objectWithoutProperties(_this$props10, _excluded4);
1664
1669
  var _this$state3 = this.state,
1665
1670
  enablePagination = _this$state3.pagination,
@@ -1669,6 +1674,11 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1669
1674
  loading = _this$state3.loading;
1670
1675
  var mPage = _typeof(pagination) === 'object' ? pagination : {};
1671
1676
  var footer = [];
1677
+ if (extraFooterLeft) {
1678
+ footer.push( /*#__PURE__*/React.createElement(Fragment, {
1679
+ key: "data-grid-extra-footer-left"
1680
+ }, extraFooterLeft));
1681
+ }
1672
1682
  var gridRowSelection;
1673
1683
  if (rowSelection !== undefined) {
1674
1684
  if (rowSelection.type === 'radio') {
@@ -236,4 +236,8 @@ export interface DataGridProps<TData> extends Omit<AgGridReactProps<TData>, 'row
236
236
  * @descriptioin 列定制启用汇总
237
237
  */
238
238
  enableCustomColumnSummary?: boolean;
239
+ /**
240
+ * @description 表格底部左侧额外的元素
241
+ */
242
+ extraFooterLeft?: ReactElement;
239
243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://registry.npmjs.org"
60
60
  },
61
- "gitHead": "804c56e7ca26df410ba801265e29ea06deb4b715"
61
+ "gitHead": "4a0de8d6cf3909a13c3f7f1b8ff1e9354697275a"
62
62
  }