@chaoswise/ui 2.2.9 → 2.3.0

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.
Files changed (50) hide show
  1. package/lib/AbreastLayout/index.js +5 -1
  2. package/lib/BasicLayout/Sider.js +8 -3
  3. package/lib/BasicLayout/index.js +10 -2
  4. package/lib/CWCascader/Cascader/index.js +207 -0
  5. package/lib/CWCascader/index.js +5 -0
  6. package/lib/CWCascader/index.less +9 -0
  7. package/lib/CWCascader/rc-cascader/Cascader.js +329 -0
  8. package/lib/CWCascader/rc-cascader/OptionList/Checkbox.js +22 -0
  9. package/lib/CWCascader/rc-cascader/OptionList/Column.js +209 -0
  10. package/lib/CWCascader/rc-cascader/OptionList/index.js +215 -0
  11. package/lib/CWCascader/rc-cascader/OptionList/useActive.js +33 -0
  12. package/lib/CWCascader/rc-cascader/OptionList/useKeyboard.js +177 -0
  13. package/lib/CWCascader/rc-cascader/context.js +3 -0
  14. package/lib/CWCascader/rc-cascader/hooks/useDisplayValues.js +56 -0
  15. package/lib/CWCascader/rc-cascader/hooks/useEntities.js +48 -0
  16. package/lib/CWCascader/rc-cascader/hooks/useMissingValues.js +19 -0
  17. package/lib/CWCascader/rc-cascader/hooks/useRefFunc.js +13 -0
  18. package/lib/CWCascader/rc-cascader/hooks/useSearchConfig.js +30 -0
  19. package/lib/CWCascader/rc-cascader/hooks/useSearchOptions.js +74 -0
  20. package/lib/CWCascader/rc-cascader/index.js +2 -0
  21. package/lib/CWCascader/rc-cascader/utils/commonUtil.js +54 -0
  22. package/lib/CWCascader/rc-cascader/utils/treeUtil.js +37 -0
  23. package/lib/CWCascader/rc-cascader/utils/warningPropsUtil.js +30 -0
  24. package/lib/CWRangePicker/index.js +6 -1
  25. package/lib/CWSelect/index.js +9 -1
  26. package/lib/CWSelect/index.less +10 -0
  27. package/lib/Cascader/index.js +0 -8
  28. package/lib/Cascader/index.less +5 -0
  29. package/lib/Cascaders/Cascader/index.js +208 -0
  30. package/lib/Cascaders/index.js +17 -0
  31. package/lib/Cascaders/index.less +1 -0
  32. package/lib/Cascaders/rc-cascader/Cascader.js +326 -0
  33. package/lib/Cascaders/rc-cascader/OptionList/Checkbox.js +22 -0
  34. package/lib/Cascaders/rc-cascader/OptionList/Column.js +203 -0
  35. package/lib/Cascaders/rc-cascader/OptionList/index.js +213 -0
  36. package/lib/Cascaders/rc-cascader/OptionList/useActive.js +33 -0
  37. package/lib/Cascaders/rc-cascader/OptionList/useKeyboard.js +171 -0
  38. package/lib/Cascaders/rc-cascader/context.js +3 -0
  39. package/lib/Cascaders/rc-cascader/hooks/useDisplayValues.js +56 -0
  40. package/lib/Cascaders/rc-cascader/hooks/useEntities.js +34 -0
  41. package/lib/Cascaders/rc-cascader/hooks/useMissingValues.js +19 -0
  42. package/lib/Cascaders/rc-cascader/hooks/useRefFunc.js +13 -0
  43. package/lib/Cascaders/rc-cascader/hooks/useSearchConfig.js +25 -0
  44. package/lib/Cascaders/rc-cascader/hooks/useSearchOptions.js +72 -0
  45. package/lib/Cascaders/rc-cascader/index.js +2 -0
  46. package/lib/Cascaders/rc-cascader/utils/commonUtil.js +54 -0
  47. package/lib/Cascaders/rc-cascader/utils/treeUtil.js +37 -0
  48. package/lib/Cascaders/rc-cascader/utils/warningPropsUtil.js +30 -0
  49. package/lib/CitySelect/index.js +2 -2
  50. package/package.json +3 -3
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ var CascaderContext = /*#__PURE__*/React.createContext(null);
3
+ export default CascaderContext;
@@ -0,0 +1,56 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
8
+ import { toPathOptions } from '../utils/treeUtil';
9
+ import * as React from 'react';
10
+ import { toPathKey } from '../utils/commonUtil';
11
+ export default (function (rawValues, options, fieldNames, multiple, displayRender) {
12
+ return React.useMemo(function () {
13
+ var mergedDisplayRender = displayRender ||
14
+ // Default displayRender
15
+ function (labels) {
16
+ var mergedLabels = multiple ? labels.slice(-1) : labels;
17
+ var SPLIT = ' / ';
18
+ if (mergedLabels.every(function (label) {
19
+ return ['string', 'number'].includes(_typeof(label));
20
+ })) {
21
+ return mergedLabels.join(SPLIT);
22
+ }
23
+ // If exist non-string value, use ReactNode instead
24
+ return mergedLabels.reduce(function (list, label, index) {
25
+ var keyedLabel = /*#__PURE__*/React.isValidElement(label) ? /*#__PURE__*/React.cloneElement(label, {
26
+ key: index
27
+ }) : label;
28
+ if (index === 0) {
29
+ return [keyedLabel];
30
+ }
31
+ return [].concat(_toConsumableArray(list), [SPLIT, keyedLabel]);
32
+ }, []);
33
+ };
34
+ return rawValues.map(function (valueCells) {
35
+ var _valueOptions, _valueOptions$option;
36
+ var valueOptions = toPathOptions(valueCells, options, fieldNames);
37
+ var label = mergedDisplayRender(valueOptions.map(function (_ref) {
38
+ var _option$fieldNames$la;
39
+ var option = _ref.option,
40
+ value = _ref.value;
41
+ return (_option$fieldNames$la = option === null || option === void 0 ? void 0 : option[fieldNames.label]) !== null && _option$fieldNames$la !== void 0 ? _option$fieldNames$la : value;
42
+ }), valueOptions.map(function (_ref2) {
43
+ var option = _ref2.option;
44
+ return option;
45
+ }));
46
+ var value = toPathKey(valueCells);
47
+ return {
48
+ label: label,
49
+ value: value,
50
+ key: value,
51
+ valueCells: valueCells,
52
+ disabled: (_valueOptions = valueOptions[valueOptions.length - 1]) === null || _valueOptions === void 0 ? void 0 : (_valueOptions$option = _valueOptions.option) === null || _valueOptions$option === void 0 ? void 0 : _valueOptions$option.disabled
53
+ };
54
+ });
55
+ }, [rawValues, options, fieldNames, displayRender, multiple]);
56
+ });
@@ -0,0 +1,48 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ /*
8
+ * @Author: andrew.qiao andrew.qiao@cloudwise.com
9
+ * @Date: 2023-05-30 06:35:28
10
+ * @LastEditors: andrew.qiao andrew.qiao@cloudwise.com
11
+ * @LastEditTime: 2023-05-30 06:48:47
12
+ * @FilePath: /change_01/aops_web_commons/packages/ui/components/Cascaders copy/rc-cascader/hooks/useEntities.js
13
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
14
+ */
15
+ import * as React from 'react';
16
+ import { convertDataToEntities } from 'rc-cascader/node_modules/rc-tree/lib/utils/treeUtil';
17
+ import { VALUE_SPLIT } from '../utils/commonUtil';
18
+ /** Lazy parse options data into conduct-able info to avoid perf issue in single mode */
19
+ export default (function (options, fieldNames) {
20
+ var cacheRef = React.useRef({
21
+ options: null,
22
+ info: null
23
+ });
24
+ var getEntities = React.useCallback(function () {
25
+ if (cacheRef.current.options !== options) {
26
+ cacheRef.current.options = options;
27
+ cacheRef.current.info = convertDataToEntities(options, {
28
+ fieldNames: fieldNames,
29
+ initWrapper: function initWrapper(wrapper) {
30
+ return _objectSpread(_objectSpread({}, wrapper), {}, {
31
+ pathKeyEntities: {}
32
+ });
33
+ },
34
+ processEntity: function processEntity(entity, wrapper) {
35
+ var pathKey = entity.nodes.map(function (node) {
36
+ return node[fieldNames.value];
37
+ }).join(VALUE_SPLIT);
38
+ wrapper.pathKeyEntities[pathKey] = entity;
39
+ // Overwrite origin key.
40
+ // this is very hack but we need let conduct logic work with connect path
41
+ entity.key = pathKey;
42
+ }
43
+ });
44
+ }
45
+ return cacheRef.current.info.pathKeyEntities;
46
+ }, [fieldNames, options]);
47
+ return getEntities;
48
+ });
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { toPathOptions } from '../utils/treeUtil';
3
+ export default (function (options, fieldNames) {
4
+ return React.useCallback(function (rawValues) {
5
+ var missingValues = [];
6
+ var existsValues = [];
7
+ rawValues.forEach(function (valueCell) {
8
+ var pathOptions = toPathOptions(valueCell, options, fieldNames);
9
+ if (pathOptions.every(function (opt) {
10
+ return opt.option;
11
+ })) {
12
+ existsValues.push(valueCell);
13
+ } else {
14
+ missingValues.push(valueCell);
15
+ }
16
+ });
17
+ return [existsValues, missingValues];
18
+ }, [options, fieldNames]);
19
+ });
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Same as `React.useCallback` but always return a memoized function
4
+ * but redirect to real function.
5
+ */
6
+ export default function useRefFunc(callback) {
7
+ var funcRef = React.useRef();
8
+ funcRef.current = callback;
9
+ var cacheFn = React.useCallback(function () {
10
+ return funcRef.current.apply(funcRef, arguments);
11
+ }, []);
12
+ return cacheFn;
13
+ }
@@ -0,0 +1,30 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
+ 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; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
7
+ import * as React from 'react';
8
+ import warning from 'rc-util/lib/warning';
9
+ // Convert `showSearch` to unique config
10
+ export default function useSearchConfig(showSearch) {
11
+ return React.useMemo(function () {
12
+ if (!showSearch) {
13
+ return [false, {}];
14
+ }
15
+ var searchConfig = {
16
+ matchInputWidth: true,
17
+ limit: 50
18
+ };
19
+ if (showSearch && _typeof(showSearch) === 'object') {
20
+ searchConfig = _objectSpread(_objectSpread({}, searchConfig), showSearch);
21
+ }
22
+ if (searchConfig.limit <= 0) {
23
+ delete searchConfig.limit;
24
+ if (process.env.NODE_ENV !== 'production') {
25
+ warning(false, "'limit' of showSearch should be positive number or false.");
26
+ }
27
+ }
28
+ return [true, searchConfig];
29
+ }, [showSearch]);
30
+ }
@@ -0,0 +1,74 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
+ import * as React from 'react';
14
+ export var SEARCH_MARK = '__rc_cascader_search_mark__';
15
+ var defaultFilter = function defaultFilter(search, options, _ref) {
16
+ var label = _ref.label;
17
+ return options.some(function (opt) {
18
+ return String(opt[label]).toLowerCase().includes(search.toLowerCase());
19
+ });
20
+ };
21
+ var defaultRender = function defaultRender(inputValue, path, prefixCls, fieldNames) {
22
+ return path.map(function (opt) {
23
+ return opt[fieldNames.label];
24
+ }).join(' / ');
25
+ };
26
+ export default (function (search, options, fieldNames, prefixCls, config, changeOnSelect) {
27
+ var _config$filter = config.filter,
28
+ filter = _config$filter === void 0 ? defaultFilter : _config$filter,
29
+ _config$render = config.render,
30
+ render = _config$render === void 0 ? defaultRender : _config$render,
31
+ _config$limit = config.limit,
32
+ limit = _config$limit === void 0 ? 50 : _config$limit,
33
+ sort = config.sort;
34
+ return React.useMemo(function () {
35
+ var filteredOptions = [];
36
+ if (!search) {
37
+ return [];
38
+ }
39
+ function dig(list, pathOptions) {
40
+ list.forEach(function (option) {
41
+ // Perf saving when `sort` is disabled and `limit` is provided
42
+ if (!sort && limit > 0 && filteredOptions.length >= limit) {
43
+ return;
44
+ }
45
+ var connectedPathOptions = [].concat(_toConsumableArray(pathOptions), [option]);
46
+ var children = option[fieldNames.children];
47
+ // If current option is filterable
48
+ if (
49
+ // If is leaf option
50
+ !children || children.length === 0 ||
51
+ // If is changeOnSelect
52
+ changeOnSelect) {
53
+ if (filter(search, connectedPathOptions, {
54
+ label: fieldNames.label
55
+ })) {
56
+ var _objectSpread2;
57
+ filteredOptions.push(_objectSpread(_objectSpread({}, option), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, fieldNames.label, render(search, connectedPathOptions, prefixCls, fieldNames)), _defineProperty(_objectSpread2, SEARCH_MARK, connectedPathOptions), _objectSpread2)));
58
+ }
59
+ }
60
+ if (children) {
61
+ dig(option[fieldNames.children], connectedPathOptions);
62
+ }
63
+ });
64
+ }
65
+ dig(options, []);
66
+ // Do sort
67
+ if (sort) {
68
+ filteredOptions.sort(function (a, b) {
69
+ return sort(a[SEARCH_MARK], b[SEARCH_MARK], search, fieldNames);
70
+ });
71
+ }
72
+ return limit > 0 ? filteredOptions.slice(0, limit) : filteredOptions;
73
+ }, [search, options, fieldNames, prefixCls, render, changeOnSelect, filter, sort, limit]);
74
+ });
@@ -0,0 +1,2 @@
1
+ import Cascader from './Cascader';
2
+ export default Cascader;
@@ -0,0 +1,54 @@
1
+ import { SEARCH_MARK } from '../hooks/useSearchOptions';
2
+ export var VALUE_SPLIT = '__RC_CASCADER_SPLIT__';
3
+ export var SHOW_PARENT = 'SHOW_PARENT';
4
+ export var SHOW_CHILD = 'SHOW_CHILD';
5
+ export function toPathKey(value) {
6
+ return value.join(VALUE_SPLIT);
7
+ }
8
+ export function toPathKeys(value) {
9
+ return value.map(toPathKey);
10
+ }
11
+ export function toPathValueStr(pathKey) {
12
+ return pathKey.split(VALUE_SPLIT);
13
+ }
14
+ export function fillFieldNames(fieldNames) {
15
+ var _ref = fieldNames || {},
16
+ label = _ref.label,
17
+ value = _ref.value,
18
+ children = _ref.children;
19
+ var val = value || 'value';
20
+ return {
21
+ label: label || 'label',
22
+ value: val,
23
+ key: val,
24
+ children: children || 'children'
25
+ };
26
+ }
27
+ export function isLeaf(option, fieldNames) {
28
+ var _option$isLeaf, _option$fieldNames$ch;
29
+ return (_option$isLeaf = option.isLeaf) !== null && _option$isLeaf !== void 0 ? _option$isLeaf : !((_option$fieldNames$ch = option[fieldNames.children]) !== null && _option$fieldNames$ch !== void 0 && _option$fieldNames$ch.length);
30
+ }
31
+ export function scrollIntoParentView(element) {
32
+ var parent = element.parentElement;
33
+ if (!parent) {
34
+ return;
35
+ }
36
+ var elementToParent = element.offsetTop - parent.offsetTop; // offsetParent may not be parent.
37
+ if (elementToParent - parent.scrollTop < 0) {
38
+ parent.scrollTo({
39
+ top: elementToParent
40
+ });
41
+ } else if (elementToParent + element.offsetHeight - parent.scrollTop > parent.offsetHeight) {
42
+ parent.scrollTo({
43
+ top: elementToParent + element.offsetHeight - parent.offsetHeight
44
+ });
45
+ }
46
+ }
47
+ export function getFullPathKeys(options, fieldNames) {
48
+ return options.map(function (item) {
49
+ var _item$SEARCH_MARK;
50
+ return (_item$SEARCH_MARK = item[SEARCH_MARK]) === null || _item$SEARCH_MARK === void 0 ? void 0 : _item$SEARCH_MARK.map(function (opt) {
51
+ return opt[fieldNames.value];
52
+ });
53
+ });
54
+ }
@@ -0,0 +1,37 @@
1
+ import { SHOW_CHILD } from './commonUtil';
2
+ export function formatStrategyValues(pathKeys, getKeyPathEntities, showCheckedStrategy) {
3
+ var valueSet = new Set(pathKeys);
4
+ var keyPathEntities = getKeyPathEntities();
5
+ return pathKeys.filter(function (key) {
6
+ var entity = keyPathEntities[key];
7
+ var parent = entity ? entity.parent : null;
8
+ var children = entity ? entity.children : null;
9
+ return showCheckedStrategy === SHOW_CHILD ? !(children && children.some(function (child) {
10
+ return child.key && valueSet.has(child.key);
11
+ })) : !(parent && !parent.node.disabled && valueSet.has(parent.key));
12
+ });
13
+ }
14
+ export function toPathOptions(valueCells, options, fieldNames) {
15
+ var stringMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
16
+ var currentList = options;
17
+ var valueOptions = [];
18
+ var _loop = function _loop() {
19
+ var _currentList, _currentList2, _foundOption$fieldNam;
20
+ var valueCell = valueCells[i];
21
+ var foundIndex = (_currentList = currentList) === null || _currentList === void 0 ? void 0 : _currentList.findIndex(function (option) {
22
+ var val = option[fieldNames.value];
23
+ return stringMode ? String(val) === String(valueCell) : val === valueCell;
24
+ });
25
+ var foundOption = foundIndex !== -1 ? (_currentList2 = currentList) === null || _currentList2 === void 0 ? void 0 : _currentList2[foundIndex] : null;
26
+ valueOptions.push({
27
+ value: (_foundOption$fieldNam = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.value]) !== null && _foundOption$fieldNam !== void 0 ? _foundOption$fieldNam : valueCell,
28
+ index: foundIndex,
29
+ option: foundOption
30
+ });
31
+ currentList = foundOption === null || foundOption === void 0 ? void 0 : foundOption[fieldNames.children];
32
+ };
33
+ for (var i = 0; i < valueCells.length; i += 1) {
34
+ _loop();
35
+ }
36
+ return valueOptions;
37
+ }
@@ -0,0 +1,30 @@
1
+ import warning from 'rc-util/lib/warning';
2
+ function warningProps(props) {
3
+ var onPopupVisibleChange = props.onPopupVisibleChange,
4
+ popupVisible = props.popupVisible,
5
+ popupClassName = props.popupClassName,
6
+ popupPlacement = props.popupPlacement;
7
+ warning(!onPopupVisibleChange, '`onPopupVisibleChange` is deprecated. Please use `onDropdownVisibleChange` instead.');
8
+ warning(popupVisible === undefined, '`popupVisible` is deprecated. Please use `open` instead.');
9
+ warning(popupClassName === undefined, '`popupClassName` is deprecated. Please use `dropdownClassName` instead.');
10
+ warning(popupPlacement === undefined, '`popupPlacement` is deprecated. Please use `placement` instead.');
11
+ }
12
+ // value in Cascader options should not be null
13
+ export function warningNullOptions(options, fieldNames) {
14
+ if (options) {
15
+ var recursiveOptions = function recursiveOptions(optionsList) {
16
+ for (var i = 0; i < optionsList.length; i++) {
17
+ var option = optionsList[i];
18
+ if (option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value] === null) {
19
+ warning(false, '`value` in Cascader options should not be `null`.');
20
+ return true;
21
+ }
22
+ if (Array.isArray(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children]) && recursiveOptions(option[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children])) {
23
+ return true;
24
+ }
25
+ }
26
+ };
27
+ recursiveOptions(options);
28
+ }
29
+ }
30
+ export default warningProps;
@@ -160,7 +160,8 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
160
160
  var _refreshRef$current;
161
161
  return {
162
162
  onStop: onStop,
163
- onRefresh: (_refreshRef$current = refreshRef.current) === null || _refreshRef$current === void 0 ? void 0 : _refreshRef$current.onRefresh
163
+ onRefresh: (_refreshRef$current = refreshRef.current) === null || _refreshRef$current === void 0 ? void 0 : _refreshRef$current.onRefresh,
164
+ onClickAutoRefresh: onClickAutoRefresh
164
165
  };
165
166
  });
166
167
  // 初始时记录当前时间项
@@ -363,6 +364,10 @@ var CWRangePicker = /*#__PURE__*/forwardRef(function (props, ref) {
363
364
  ((_refreshRef$current2 = refreshRef.current) === null || _refreshRef$current2 === void 0 ? void 0 : _refreshRef$current2.onAutoRefresh) && ((_refreshRef$current3 = refreshRef.current) === null || _refreshRef$current3 === void 0 ? void 0 : _refreshRef$current3.onAutoRefresh());
364
365
  }
365
366
  };
367
+ var onClickAutoRefresh = function onClickAutoRefresh() {
368
+ var _refreshRef$current4, _refreshRef$current5;
369
+ ((_refreshRef$current4 = refreshRef.current) === null || _refreshRef$current4 === void 0 ? void 0 : _refreshRef$current4.onAutoRefresh) && ((_refreshRef$current5 = refreshRef.current) === null || _refreshRef$current5 === void 0 ? void 0 : _refreshRef$current5.onAutoRefresh());
370
+ };
366
371
  // 输入框回车按下
367
372
  var onPressEnter = function onPressEnter(e) {
368
373
  if (!isInputRef.current) return;
@@ -400,7 +400,15 @@ var CWSelect = /*#__PURE__*/forwardRef(function (props, ref) {
400
400
  return !dataSource.length ? /*#__PURE__*/React.createElement("div", {
401
401
  className: "cw-select-show-checkbox-empty"
402
402
  }, localeObj["no-results-were-found"]) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
403
- className: "cw-checkbox-all"
403
+ className: "cw-checkbox-all",
404
+ onMouseDown: function onMouseDown(e) {
405
+ e.preventDefault();
406
+ e.stopPropagation();
407
+ },
408
+ onClick: function onClick(e) {
409
+ e.preventDefault();
410
+ e.stopPropagation();
411
+ }
404
412
  }, /*#__PURE__*/React.createElement(_Checkbox, {
405
413
  indeterminate: filterActiveValues.length && filterActiveValues.length !== dataSource.length,
406
414
  checked: filterActiveValues.length === dataSource.length,
@@ -695,6 +695,9 @@
695
695
  &.cw-select-dropdown-has-checkbox{
696
696
  .cw-checkbox-all{
697
697
  padding: 6px 10px;
698
+ &:hover{
699
+ background-color: @select-item-active-bg;
700
+ }
698
701
  }
699
702
  .@{select-prefix-cls}-item{
700
703
  padding: 6px 10px;
@@ -710,6 +713,13 @@
710
713
  flex: 1;
711
714
  overflow: hidden;
712
715
  }
716
+ &:hover{
717
+ .@{ant-prefix}-checkbox{
718
+ .@{ant-prefix}-checkbox-inner{
719
+ border-color:@checkbox-color;
720
+ }
721
+ }
722
+ }
713
723
  }
714
724
  }
715
725
  }
@@ -1,12 +1,4 @@
1
1
  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); }
2
- /*
3
- * @Author: andrew.qiao andrew.qiao@cloudwise.com
4
- * @Date: 2023-05-11 15:08:15
5
- * @LastEditors: andrew.qiao andrew.qiao@cloudwise.com
6
- * @LastEditTime: 2023-05-11 19:15:27
7
- * @FilePath: /change_01/aops_web_commons/packages/ui/components/Cascader/index.js
8
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
9
- */
10
2
  import React, { forwardRef } from "react";
11
3
  import Cascader from "../Antd4/cascader";
12
4
  import "antd/es/cascader/style/index.less";
@@ -2,4 +2,9 @@
2
2
 
3
3
  .@{cascader-prefix-cls}-menus {
4
4
  position: static !important;
5
+ }
6
+ .@{cascader-prefix-cls}.@{ant-prefix}-select{
7
+ .@{ant-prefix}-select-selection-overflow{
8
+ flex: 0 1 auto;
9
+ }
5
10
  }