@douyinfe/semi-foundation 2.72.0-beta.0 → 2.72.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.
- package/lib/cjs/tree/constants.d.ts +1 -0
- package/lib/cjs/tree/constants.js +2 -1
- package/lib/cjs/tree/foundation.js +2 -1
- package/lib/cjs/tree/treeUtil.js +2 -1
- package/lib/cjs/treeSelect/foundation.d.ts +1 -3
- package/lib/es/tree/constants.d.ts +1 -0
- package/lib/es/tree/constants.js +2 -1
- package/lib/es/tree/foundation.js +2 -1
- package/lib/es/tree/treeUtil.js +2 -1
- package/lib/es/treeSelect/foundation.d.ts +1 -3
- package/package.json +4 -4
- package/tree/constants.ts +1 -0
- package/tree/foundation.ts +2 -1
- package/tree/treeUtil.ts +2 -1
|
@@ -10,6 +10,7 @@ const cssClasses = exports.cssClasses = {
|
|
|
10
10
|
PREFIX_OPTION: `${_constants.BASE_CLASS_PREFIX}-tree-option`
|
|
11
11
|
};
|
|
12
12
|
const strings = exports.strings = {
|
|
13
|
-
EXPAND_ACTION: [false, 'click', 'doubleClick']
|
|
13
|
+
EXPAND_ACTION: [false, 'click', 'doubleClick'],
|
|
14
|
+
JSON_KEY_SPLIT: '_SEMI_TREE_SPLIT_'
|
|
14
15
|
};
|
|
15
16
|
const numbers = exports.numbers = {};
|
|
@@ -10,6 +10,7 @@ var _difference2 = _interopRequireDefault(require("lodash/difference"));
|
|
|
10
10
|
var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
|
|
11
11
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
12
12
|
var _treeUtil = require("./treeUtil");
|
|
13
|
+
var _constants = require("./constants");
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
/**
|
|
15
16
|
* The drag and drop handler implementation is referenced from rc-tree
|
|
@@ -111,7 +112,7 @@ class TreeFoundation extends _foundation.default {
|
|
|
111
112
|
}
|
|
112
113
|
notifyJsonChange(key, e) {
|
|
113
114
|
const data = this.getProp('treeDataSimpleJson');
|
|
114
|
-
const selectedPath = (0, _treeUtil.normalizedArr)(key).map(i => i.
|
|
115
|
+
const selectedPath = (0, _treeUtil.normalizedArr)(key).map(i => i.replaceAll(_constants.strings.JSON_KEY_SPLIT, '.'));
|
|
115
116
|
const value = (0, _pick2.default)(data, selectedPath);
|
|
116
117
|
this._adapter.notifyChange(value);
|
|
117
118
|
}
|
package/lib/cjs/tree/treeUtil.js
CHANGED
|
@@ -41,6 +41,7 @@ var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
|
|
41
41
|
var _max2 = _interopRequireDefault(require("lodash/max"));
|
|
42
42
|
var _uniq2 = _interopRequireDefault(require("lodash/uniq"));
|
|
43
43
|
var _difference2 = _interopRequireDefault(require("lodash/difference"));
|
|
44
|
+
var _constants = require("./constants");
|
|
44
45
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
45
46
|
/**
|
|
46
47
|
* Part of the utils function implementation process reference
|
|
@@ -109,7 +110,7 @@ function convertJsonToData(treeJson) {
|
|
|
109
110
|
const treeData = [];
|
|
110
111
|
const traverseNode = (key, children, path, res) => {
|
|
111
112
|
const currPath = [...path, key];
|
|
112
|
-
const itemKey = currPath.join(
|
|
113
|
+
const itemKey = currPath.join(_constants.strings.JSON_KEY_SPLIT);
|
|
113
114
|
const newNode = {
|
|
114
115
|
key: itemKey,
|
|
115
116
|
label: key,
|
|
@@ -162,9 +162,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
162
162
|
handleSingleSelect(e: any, treeNode: BasicTreeNodeProps): void;
|
|
163
163
|
calcCheckedKeys(eventKey: BasicTreeNodeProps['eventKey'], targetStatus: boolean): {
|
|
164
164
|
checkedKeys: Set<string>;
|
|
165
|
-
halfCheckedKeys: Set<string>;
|
|
166
|
-
* A11y: simulate selection click
|
|
167
|
-
*/
|
|
165
|
+
halfCheckedKeys: Set<string>;
|
|
168
166
|
};
|
|
169
167
|
handleMultipleSelect(e: any, treeNode: BasicTreeNodeProps): void;
|
|
170
168
|
calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean): {
|
package/lib/es/tree/constants.js
CHANGED
|
@@ -4,7 +4,8 @@ const cssClasses = {
|
|
|
4
4
|
PREFIX_OPTION: `${BASE_CLASS_PREFIX}-tree-option`
|
|
5
5
|
};
|
|
6
6
|
const strings = {
|
|
7
|
-
EXPAND_ACTION: [false, 'click', 'doubleClick']
|
|
7
|
+
EXPAND_ACTION: [false, 'click', 'doubleClick'],
|
|
8
|
+
JSON_KEY_SPLIT: '_SEMI_TREE_SPLIT_'
|
|
8
9
|
};
|
|
9
10
|
const numbers = {};
|
|
10
11
|
export { cssClasses, strings, numbers };
|
|
@@ -8,6 +8,7 @@ import _isUndefined from "lodash/isUndefined";
|
|
|
8
8
|
*/
|
|
9
9
|
import BaseFoundation from '../base/foundation';
|
|
10
10
|
import { flattenTreeData, findDescendantKeys, findAncestorKeys, filter, normalizedArr, normalizeKeyList, getMotionKeys, calcCheckedKeysForChecked, calcCheckedKeysForUnchecked, calcCheckedKeys, getValueOrKey, getDragNodesKeys, calcDropRelativePosition, calcDropActualPosition } from './treeUtil';
|
|
11
|
+
import { strings } from './constants';
|
|
11
12
|
export default class TreeFoundation extends BaseFoundation {
|
|
12
13
|
constructor(adapter) {
|
|
13
14
|
super(Object.assign({}, adapter));
|
|
@@ -103,7 +104,7 @@ export default class TreeFoundation extends BaseFoundation {
|
|
|
103
104
|
}
|
|
104
105
|
notifyJsonChange(key, e) {
|
|
105
106
|
const data = this.getProp('treeDataSimpleJson');
|
|
106
|
-
const selectedPath = normalizedArr(key).map(i => i.
|
|
107
|
+
const selectedPath = normalizedArr(key).map(i => i.replaceAll(strings.JSON_KEY_SPLIT, '.'));
|
|
107
108
|
const value = _pick(data, selectedPath);
|
|
108
109
|
this._adapter.notifyChange(value);
|
|
109
110
|
}
|
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -12,6 +12,7 @@ import _difference from "lodash/difference";
|
|
|
12
12
|
* Part of the utils function implementation process reference
|
|
13
13
|
* https://github.com/react-component/tree/blob/master/src/util.tsx
|
|
14
14
|
*/
|
|
15
|
+
import { strings } from './constants';
|
|
15
16
|
const DRAG_OFFSET = 0.45;
|
|
16
17
|
function getPosition(level, index) {
|
|
17
18
|
return `${level}-${index}`;
|
|
@@ -74,7 +75,7 @@ export function convertJsonToData(treeJson) {
|
|
|
74
75
|
const treeData = [];
|
|
75
76
|
const traverseNode = (key, children, path, res) => {
|
|
76
77
|
const currPath = [...path, key];
|
|
77
|
-
const itemKey = currPath.join(
|
|
78
|
+
const itemKey = currPath.join(strings.JSON_KEY_SPLIT);
|
|
78
79
|
const newNode = {
|
|
79
80
|
key: itemKey,
|
|
80
81
|
label: key,
|
|
@@ -162,9 +162,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
|
|
|
162
162
|
handleSingleSelect(e: any, treeNode: BasicTreeNodeProps): void;
|
|
163
163
|
calcCheckedKeys(eventKey: BasicTreeNodeProps['eventKey'], targetStatus: boolean): {
|
|
164
164
|
checkedKeys: Set<string>;
|
|
165
|
-
halfCheckedKeys: Set<string>;
|
|
166
|
-
* A11y: simulate selection click
|
|
167
|
-
*/
|
|
165
|
+
halfCheckedKeys: Set<string>;
|
|
168
166
|
};
|
|
169
167
|
handleMultipleSelect(e: any, treeNode: BasicTreeNodeProps): void;
|
|
170
168
|
calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean): {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.72.0
|
|
3
|
+
"version": "2.72.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
7
7
|
"prepublishOnly": "npm run build:lib"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@douyinfe/semi-animation": "2.72.0
|
|
11
|
-
"@douyinfe/semi-json-viewer-core": "2.72.0
|
|
10
|
+
"@douyinfe/semi-animation": "2.72.0",
|
|
11
|
+
"@douyinfe/semi-json-viewer-core": "2.72.0",
|
|
12
12
|
"@mdx-js/mdx": "^3.0.1",
|
|
13
13
|
"async-validator": "^3.5.0",
|
|
14
14
|
"classnames": "^2.2.6",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"*.scss",
|
|
30
30
|
"*.css"
|
|
31
31
|
],
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "66267e4192e4ef74683aaf53e4e721908b1cea0d",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
35
35
|
"@babel/preset-env": "^7.15.8",
|
package/tree/constants.ts
CHANGED
package/tree/foundation.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
} from './treeUtil';
|
|
24
24
|
|
|
25
25
|
import type { KeyMapProps } from './treeUtil';
|
|
26
|
+
import { strings } from './constants';
|
|
26
27
|
export type { KeyMapProps };
|
|
27
28
|
|
|
28
29
|
export interface BasicTreeNodeProps {
|
|
@@ -415,7 +416,7 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
|
|
|
415
416
|
|
|
416
417
|
notifyJsonChange(key: string[] | string, e: any) {
|
|
417
418
|
const data = this.getProp('treeDataSimpleJson');
|
|
418
|
-
const selectedPath = normalizedArr(key).map(i => i.
|
|
419
|
+
const selectedPath = normalizedArr(key).map(i => i.replaceAll(strings.JSON_KEY_SPLIT, '.'));
|
|
419
420
|
const value = pick(data, selectedPath);
|
|
420
421
|
this._adapter.notifyChange(value as BasicValue);
|
|
421
422
|
}
|
package/tree/treeUtil.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { difference, uniq, max, isObject, isNull, isUndefined, isEmpty, pick, get, omit } from 'lodash';
|
|
7
|
+
import { strings } from './constants';
|
|
7
8
|
|
|
8
9
|
export interface KeyEntities {
|
|
9
10
|
[x: string]: any
|
|
@@ -98,7 +99,7 @@ export function convertJsonToData(treeJson: TreeDataSimpleJson) {
|
|
|
98
99
|
const treeData: any[] = [];
|
|
99
100
|
const traverseNode = (key: string, children: any, path: any, res: any[]) => {
|
|
100
101
|
const currPath = [...path, key];
|
|
101
|
-
const itemKey = currPath.join(
|
|
102
|
+
const itemKey = currPath.join(strings.JSON_KEY_SPLIT);
|
|
102
103
|
|
|
103
104
|
const newNode: NodeData = {
|
|
104
105
|
key: itemKey,
|