assui 2.1.52 → 2.1.53
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/es/index.d.ts +1 -0
- package/es/json-editor/index.d.ts +10 -2
- package/es/json-editor/index.js +93 -7
- package/es/json-editor/style/index.css +3 -0
- package/es/json-editor/style/index.d.ts +1 -0
- package/es/json-editor/style/index.js +2 -1
- package/es/json-editor/style/index.less +5 -0
- package/es/label-customize-range-picker/index.js +9 -1
- package/lib/index.d.ts +1 -0
- package/lib/json-editor/index.d.ts +10 -2
- package/lib/json-editor/index.js +97 -6
- package/lib/json-editor/style/index.css +3 -0
- package/lib/json-editor/style/index.d.ts +1 -0
- package/lib/json-editor/style/index.js +3 -1
- package/lib/json-editor/style/index.less +5 -0
- package/lib/label-customize-range-picker/index.js +9 -1
- package/package.json +5 -2
package/es/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export type { LabelTextAreaProps } from './label-text-area';
|
|
|
48
48
|
export { default as LabelTextArea } from './label-text-area';
|
|
49
49
|
export type { AreaTextProps } from './area-text';
|
|
50
50
|
export { default as AreaText } from './area-text';
|
|
51
|
+
export type { JSONEditorProps } from './json-editor';
|
|
51
52
|
export { default as JsonEditor } from './json-editor';
|
|
52
53
|
export type { LabelRangePickerProps } from './label-range-picker';
|
|
53
54
|
export { default as LabelRangePicker } from './label-range-picker';
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { JSONEditorOptions } from 'jsoneditor';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare type JSONEditorProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
options?: JSONEditorOptions;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
value?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const ForwardRefJsonEditor: React.ForwardRefExoticComponent<JSONEditorProps & React.RefAttributes<unknown>>;
|
|
10
|
+
export default ForwardRefJsonEditor;
|
package/es/json-editor/index.js
CHANGED
|
@@ -1,17 +1,103 @@
|
|
|
1
|
+
var __assign = this && this.__assign || function () {
|
|
2
|
+
__assign = Object.assign || function (t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
|
|
6
|
+
for (var p in s) {
|
|
7
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var __read = this && this.__read || function (o, n) {
|
|
18
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
+
if (!m) return o;
|
|
20
|
+
var i = m.call(o),
|
|
21
|
+
r,
|
|
22
|
+
ar = [],
|
|
23
|
+
e;
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
27
|
+
ar.push(r.value);
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
e = {
|
|
31
|
+
error: error
|
|
32
|
+
};
|
|
33
|
+
} finally {
|
|
34
|
+
try {
|
|
35
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
+
} finally {
|
|
37
|
+
if (e) throw e.error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
|
|
1
44
|
import JSONEditor from 'jsoneditor';
|
|
2
|
-
import React, { useEffect } from 'react';
|
|
45
|
+
import React, { useEffect, useImperativeHandle } from 'react';
|
|
46
|
+
import useControllableValue from "ahooks/es/useControllableValue";
|
|
47
|
+
import useMount from "ahooks/es/useMount";
|
|
48
|
+
import isEqual from 'lodash/isEqual';
|
|
49
|
+
import useUnmount from "ahooks/es/useUnmount";
|
|
50
|
+
import classNames from 'classnames';
|
|
51
|
+
|
|
52
|
+
var JsonEditor = function JsonEditor(props, ref) {
|
|
53
|
+
var options = props.options,
|
|
54
|
+
className = props.className;
|
|
55
|
+
|
|
56
|
+
var _a = __read(useControllableValue(props), 2),
|
|
57
|
+
value = _a[0],
|
|
58
|
+
setValue = _a[1];
|
|
3
59
|
|
|
4
|
-
var Jsoneditor = function Jsoneditor() {
|
|
5
60
|
var containerRef = React.useRef();
|
|
61
|
+
var editorInstanceRef = React.useRef();
|
|
62
|
+
useMount(function () {
|
|
63
|
+
editorInstanceRef.current = new JSONEditor(containerRef.current, __assign(__assign({
|
|
64
|
+
mode: 'code',
|
|
65
|
+
indentation: 2
|
|
66
|
+
}, options), {
|
|
67
|
+
onChangeText: function onChangeText() {
|
|
68
|
+
var _a;
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
var currentJson = (_a = editorInstanceRef.current) === null || _a === void 0 ? void 0 : _a.get();
|
|
72
|
+
setValue(currentJson);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.log('error', error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
});
|
|
79
|
+
useImperativeHandle(ref, function () {
|
|
80
|
+
return containerRef.current;
|
|
81
|
+
});
|
|
6
82
|
useEffect(function () {
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
83
|
+
var _a, _b;
|
|
84
|
+
|
|
85
|
+
if (value && !isEqual(value, (_a = editorInstanceRef.current) === null || _a === void 0 ? void 0 : _a.get())) {
|
|
86
|
+
(_b = editorInstanceRef.current) === null || _b === void 0 ? void 0 : _b.update(value);
|
|
87
|
+
}
|
|
88
|
+
}, [value]);
|
|
89
|
+
useUnmount(function () {
|
|
90
|
+
var _a;
|
|
91
|
+
|
|
92
|
+
(_a = editorInstanceRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
93
|
+
});
|
|
10
94
|
return /*#__PURE__*/React.createElement("div", {
|
|
11
95
|
ref: function ref(el) {
|
|
12
96
|
return containerRef.current = el;
|
|
13
|
-
}
|
|
97
|
+
},
|
|
98
|
+
className: classNames('a-jason-editor', className)
|
|
14
99
|
});
|
|
15
100
|
};
|
|
16
101
|
|
|
17
|
-
|
|
102
|
+
var ForwardRefJsonEditor = /*#__PURE__*/React.forwardRef(JsonEditor);
|
|
103
|
+
export default ForwardRefJsonEditor;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import 'jsoneditor/dist/jsoneditor.min.css';
|
|
1
|
+
import 'jsoneditor/dist/jsoneditor.min.css';
|
|
2
|
+
import './index.less';
|
|
@@ -132,8 +132,16 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
|
132
132
|
}
|
|
133
133
|
}, [date]);
|
|
134
134
|
useEffect(function () {
|
|
135
|
+
var _a = __read(date || [], 2),
|
|
136
|
+
startTime = _a[0],
|
|
137
|
+
endTime = _a[1];
|
|
138
|
+
|
|
135
139
|
if (maxScope) {
|
|
136
|
-
|
|
140
|
+
var _b = __read(formatMaxScope(date, maxScope), 2),
|
|
141
|
+
newStartDate = _b[0],
|
|
142
|
+
newEndDate = _b[1];
|
|
143
|
+
|
|
144
|
+
if (!(newStartDate === null || newStartDate === void 0 ? void 0 : newStartDate.isSame(startTime)) || !(newEndDate === null || newEndDate === void 0 ? void 0 : newEndDate.isSame(endTime))) setDate(formatMaxScope(date, maxScope));
|
|
137
145
|
}
|
|
138
146
|
}, [maxScope]);
|
|
139
147
|
|
package/lib/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export type { LabelTextAreaProps } from './label-text-area';
|
|
|
48
48
|
export { default as LabelTextArea } from './label-text-area';
|
|
49
49
|
export type { AreaTextProps } from './area-text';
|
|
50
50
|
export { default as AreaText } from './area-text';
|
|
51
|
+
export type { JSONEditorProps } from './json-editor';
|
|
51
52
|
export { default as JsonEditor } from './json-editor';
|
|
52
53
|
export type { LabelRangePickerProps } from './label-range-picker';
|
|
53
54
|
export { default as LabelRangePicker } from './label-range-picker';
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { JSONEditorOptions } from 'jsoneditor';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare type JSONEditorProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
options?: JSONEditorOptions;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
7
|
+
value?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const ForwardRefJsonEditor: React.ForwardRefExoticComponent<JSONEditorProps & React.RefAttributes<unknown>>;
|
|
10
|
+
export default ForwardRefJsonEditor;
|
package/lib/json-editor/index.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var __assign = this && this.__assign || function () {
|
|
4
|
+
__assign = Object.assign || function (t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
|
|
8
|
+
for (var p in s) {
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
return __assign.apply(this, arguments);
|
|
17
|
+
};
|
|
18
|
+
|
|
3
19
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
20
|
if (k2 === undefined) k2 = k;
|
|
5
21
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -40,6 +56,33 @@ var __importStar = this && this.__importStar || function (mod) {
|
|
|
40
56
|
return result;
|
|
41
57
|
};
|
|
42
58
|
|
|
59
|
+
var __read = this && this.__read || function (o, n) {
|
|
60
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
61
|
+
if (!m) return o;
|
|
62
|
+
var i = m.call(o),
|
|
63
|
+
r,
|
|
64
|
+
ar = [],
|
|
65
|
+
e;
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
69
|
+
ar.push(r.value);
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
e = {
|
|
73
|
+
error: error
|
|
74
|
+
};
|
|
75
|
+
} finally {
|
|
76
|
+
try {
|
|
77
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
78
|
+
} finally {
|
|
79
|
+
if (e) throw e.error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return ar;
|
|
84
|
+
};
|
|
85
|
+
|
|
43
86
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
44
87
|
return mod && mod.__esModule ? mod : {
|
|
45
88
|
"default": mod
|
|
@@ -54,17 +97,65 @@ var jsoneditor_1 = __importDefault(require("jsoneditor"));
|
|
|
54
97
|
|
|
55
98
|
var react_1 = __importStar(require("react"));
|
|
56
99
|
|
|
57
|
-
var
|
|
100
|
+
var useControllableValue_1 = __importDefault(require("ahooks/lib/useControllableValue"));
|
|
101
|
+
|
|
102
|
+
var useMount_1 = __importDefault(require("ahooks/lib/useMount"));
|
|
103
|
+
|
|
104
|
+
var isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
105
|
+
|
|
106
|
+
var useUnmount_1 = __importDefault(require("ahooks/lib/useUnmount"));
|
|
107
|
+
|
|
108
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
109
|
+
|
|
110
|
+
var JsonEditor = function JsonEditor(props, ref) {
|
|
111
|
+
var options = props.options,
|
|
112
|
+
className = props.className;
|
|
113
|
+
|
|
114
|
+
var _a = __read((0, useControllableValue_1["default"])(props), 2),
|
|
115
|
+
value = _a[0],
|
|
116
|
+
setValue = _a[1];
|
|
117
|
+
|
|
58
118
|
var containerRef = react_1["default"].useRef();
|
|
119
|
+
var editorInstanceRef = react_1["default"].useRef();
|
|
120
|
+
(0, useMount_1["default"])(function () {
|
|
121
|
+
editorInstanceRef.current = new jsoneditor_1["default"](containerRef.current, __assign(__assign({
|
|
122
|
+
mode: 'code',
|
|
123
|
+
indentation: 2
|
|
124
|
+
}, options), {
|
|
125
|
+
onChangeText: function onChangeText() {
|
|
126
|
+
var _a;
|
|
127
|
+
|
|
128
|
+
try {
|
|
129
|
+
var currentJson = (_a = editorInstanceRef.current) === null || _a === void 0 ? void 0 : _a.get();
|
|
130
|
+
setValue(currentJson);
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.log('error', error);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}));
|
|
136
|
+
});
|
|
137
|
+
(0, react_1.useImperativeHandle)(ref, function () {
|
|
138
|
+
return containerRef.current;
|
|
139
|
+
});
|
|
59
140
|
(0, react_1.useEffect)(function () {
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
141
|
+
var _a, _b;
|
|
142
|
+
|
|
143
|
+
if (value && !(0, isEqual_1["default"])(value, (_a = editorInstanceRef.current) === null || _a === void 0 ? void 0 : _a.get())) {
|
|
144
|
+
(_b = editorInstanceRef.current) === null || _b === void 0 ? void 0 : _b.update(value);
|
|
145
|
+
}
|
|
146
|
+
}, [value]);
|
|
147
|
+
(0, useUnmount_1["default"])(function () {
|
|
148
|
+
var _a;
|
|
149
|
+
|
|
150
|
+
(_a = editorInstanceRef.current) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
151
|
+
});
|
|
63
152
|
return react_1["default"].createElement("div", {
|
|
64
153
|
ref: function ref(el) {
|
|
65
154
|
return containerRef.current = el;
|
|
66
|
-
}
|
|
155
|
+
},
|
|
156
|
+
className: (0, classnames_1["default"])('a-jason-editor', className)
|
|
67
157
|
});
|
|
68
158
|
};
|
|
69
159
|
|
|
70
|
-
|
|
160
|
+
var ForwardRefJsonEditor = react_1["default"].forwardRef(JsonEditor);
|
|
161
|
+
exports["default"] = ForwardRefJsonEditor;
|
|
@@ -196,8 +196,16 @@ var LabelCustomizeRangePicker = function LabelCustomizeRangePicker(props) {
|
|
|
196
196
|
}
|
|
197
197
|
}, [date]);
|
|
198
198
|
(0, react_1.useEffect)(function () {
|
|
199
|
+
var _a = __read(date || [], 2),
|
|
200
|
+
startTime = _a[0],
|
|
201
|
+
endTime = _a[1];
|
|
202
|
+
|
|
199
203
|
if (maxScope) {
|
|
200
|
-
|
|
204
|
+
var _b = __read((0, utils_1.formatMaxScope)(date, maxScope), 2),
|
|
205
|
+
newStartDate = _b[0],
|
|
206
|
+
newEndDate = _b[1];
|
|
207
|
+
|
|
208
|
+
if (!(newStartDate === null || newStartDate === void 0 ? void 0 : newStartDate.isSame(startTime)) || !(newEndDate === null || newEndDate === void 0 ? void 0 : newEndDate.isSame(endTime))) setDate((0, utils_1.formatMaxScope)(date, maxScope));
|
|
201
209
|
}
|
|
202
210
|
}, [maxScope]);
|
|
203
211
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.53",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
"bignumber.js": "^9.0.1",
|
|
41
41
|
"copy-to-clipboard": "^3.3.1",
|
|
42
42
|
"echarts": "^5.1.2",
|
|
43
|
+
"jsoneditor": "^9.9.0",
|
|
44
|
+
"jsoneditor-react": "^3.1.2",
|
|
43
45
|
"qrcode": "^1.4.4",
|
|
44
46
|
"rc-motion": "^2.4.4",
|
|
45
47
|
"rc-util": "^5.13.2",
|
|
@@ -60,6 +62,7 @@
|
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"@types/enzyme": "^3.10.5",
|
|
62
64
|
"@types/insert-css": "^2.0.1",
|
|
65
|
+
"@types/jsoneditor": "^9.5.1",
|
|
63
66
|
"@types/qrcode": "^1.4.1",
|
|
64
67
|
"@types/react-highlight-words": "^0.16.3",
|
|
65
68
|
"@types/react-transition-group": "^4.4.2",
|
|
@@ -73,5 +76,5 @@
|
|
|
73
76
|
"node": ">=10.0.0"
|
|
74
77
|
},
|
|
75
78
|
"license": "MIT",
|
|
76
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "5085e97dcdfa4e1af5098e8e372b7b1a5b34c98e"
|
|
77
80
|
}
|