dtable-ui-component 0.1.75-beta9 → 0.1.78
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/README.md +20 -2
- package/lib/HtmlLongTextFormatter/index.js +3 -1
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
- package/lib/HtmlLongTextFormatter/unified/index.js +7 -5
- package/lib/HtmlLongTextFormatter/vfile/core.js +3 -2
- package/lib/HtmlLongTextFormatter/vfile/index.js +4 -3
- package/lib/LongTextFormatter/index.js +2 -4
- package/lib/SimpleLongTextFormatter/index.js +3 -1
- package/lib/formatterConfig/index.js +2 -2
- package/lib/utils/value-format-utils.js +4 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -11,8 +11,26 @@ When using dtable-ui-component component library, you need to import dtable-font
|
|
|
11
11
|
|
|
12
12
|
```js
|
|
13
13
|
import { CollaboratorEditor } from 'dtable-ui-component';
|
|
14
|
-
|
|
15
14
|
import 'dtable-ui-component/assets/dtable-font.css';
|
|
16
15
|
|
|
17
16
|
...
|
|
18
|
-
```
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## load demand
|
|
20
|
+
|
|
21
|
+
If you want to use on-demand loading, add the following content to the ` .babelrc` file of your project
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
"plugins": [
|
|
25
|
+
["on-demand-loading", {"library": "dtable-ui-component"}]
|
|
26
|
+
]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Long Text Formatter
|
|
30
|
+
|
|
31
|
+
If your project only uses a simple long text formatter, you can reference the SimpleLongTextFormatter component.
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import { SimpleLongTextFormatter } from 'dtable-ui-component';
|
|
35
|
+
```
|
|
36
|
+
|
|
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React, { Component } from 'react';
|
|
6
|
+
import cn from 'astro-classname';
|
|
6
7
|
import { processor } from './markdown2html';
|
|
7
8
|
import './index.css';
|
|
8
9
|
|
|
@@ -80,7 +81,8 @@ var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
|
|
|
80
81
|
key: "render",
|
|
81
82
|
value: function render() {
|
|
82
83
|
var innerHtml = this.state.innerHtml;
|
|
83
|
-
var
|
|
84
|
+
var containerClassName = this.props.containerClassName;
|
|
85
|
+
var className = cn('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
|
|
84
86
|
if (!innerHtml) return null;
|
|
85
87
|
return /*#__PURE__*/React.createElement("div", {
|
|
86
88
|
className: "".concat(className, " article"),
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var unified = require('./unified');
|
|
2
|
-
|
|
3
1
|
var markdown = require('remark-parse');
|
|
4
2
|
|
|
5
3
|
var slug = require('remark-slug');
|
|
@@ -26,6 +24,8 @@ var mathjax = require('rehype-mathjax/browser');
|
|
|
26
24
|
|
|
27
25
|
var math = require('remark-math/block');
|
|
28
26
|
|
|
27
|
+
var unified = require('./unified').default;
|
|
28
|
+
|
|
29
29
|
function stringify(config) {
|
|
30
30
|
var settings = xtend(config, this.data('settings'));
|
|
31
31
|
var schema = deepmerge(gh, {
|
|
@@ -6,17 +6,14 @@ var extend = require('extend');
|
|
|
6
6
|
|
|
7
7
|
var bail = require('bail');
|
|
8
8
|
|
|
9
|
-
var vfile = require('../vfile');
|
|
10
|
-
|
|
11
9
|
var trough = require('trough');
|
|
12
10
|
|
|
13
11
|
var string = require('x-is-string');
|
|
14
12
|
|
|
15
13
|
var plain = require('is-plain-obj');
|
|
16
|
-
/* Expose a frozen processor. */
|
|
17
14
|
|
|
15
|
+
var vfile = require('../vfile').default;
|
|
18
16
|
|
|
19
|
-
module.exports = unified().freeze();
|
|
20
17
|
var slice = [].slice;
|
|
21
18
|
var own = {}.hasOwnProperty;
|
|
22
19
|
/* Process pipeline. */
|
|
@@ -468,4 +465,9 @@ function assertDone(name, asyncName, complete) {
|
|
|
468
465
|
if (!complete) {
|
|
469
466
|
throw new Error('`' + name + '` finished async. Use `' + asyncName + '` instead');
|
|
470
467
|
}
|
|
471
|
-
}
|
|
468
|
+
}
|
|
469
|
+
/* Expose a frozen processor. */
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
var unified_freeze = unified().freeze();
|
|
473
|
+
export default unified_freeze;
|
|
@@ -7,7 +7,6 @@ var replace = require('replace-ext');
|
|
|
7
7
|
|
|
8
8
|
var buffer = require('is-buffer');
|
|
9
9
|
|
|
10
|
-
module.exports = VFile;
|
|
11
10
|
var own = {}.hasOwnProperty;
|
|
12
11
|
var proto = VFile.prototype;
|
|
13
12
|
proto.toString = toString;
|
|
@@ -170,4 +169,6 @@ function assertPath(path, name) {
|
|
|
170
169
|
if (!path) {
|
|
171
170
|
throw new Error('Setting `' + name + '` requires `path` to be set too');
|
|
172
171
|
}
|
|
173
|
-
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export default VFile;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var VMessage = require('vfile-message');
|
|
4
4
|
|
|
5
|
-
var VFile = require('./core.js');
|
|
5
|
+
var VFile = require('./core.js').default;
|
|
6
6
|
|
|
7
|
-
module.exports = VFile;
|
|
8
7
|
var proto = VFile.prototype;
|
|
9
8
|
proto.message = message;
|
|
10
9
|
proto.info = info;
|
|
@@ -45,4 +44,6 @@ function info() {
|
|
|
45
44
|
var message = this.message.apply(this, arguments);
|
|
46
45
|
message.fatal = null;
|
|
47
46
|
return message;
|
|
48
|
-
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default VFile;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import cn from 'astro-classname';
|
|
3
2
|
import HtmlLongTextFormatter from '../HtmlLongTextFormatter';
|
|
4
3
|
import SimpleLongTextFormatter from '../SimpleLongTextFormatter';
|
|
5
4
|
|
|
@@ -7,18 +6,17 @@ function LongTextFormatter(props) {
|
|
|
7
6
|
var isSample = props.isSample,
|
|
8
7
|
value = props.value,
|
|
9
8
|
containerClassName = props.containerClassName;
|
|
10
|
-
var className = cn('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
|
|
11
9
|
|
|
12
10
|
if (isSample) {
|
|
13
11
|
return /*#__PURE__*/React.createElement(SimpleLongTextFormatter, {
|
|
14
12
|
value: value,
|
|
15
|
-
|
|
13
|
+
containerClassName: containerClassName
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
return /*#__PURE__*/React.createElement(HtmlLongTextFormatter, {
|
|
20
18
|
value: value,
|
|
21
|
-
|
|
19
|
+
containerClassName: containerClassName
|
|
22
20
|
});
|
|
23
21
|
}
|
|
24
22
|
|
|
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import cn from 'astro-classname';
|
|
6
7
|
import getPreviewContent from './normalize-long-text-value';
|
|
7
8
|
import './index.css';
|
|
8
9
|
|
|
@@ -83,7 +84,8 @@ var SimpleLongTextFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
83
84
|
_createClass(SimpleLongTextFormatter, [{
|
|
84
85
|
key: "render",
|
|
85
86
|
value: function render() {
|
|
86
|
-
var
|
|
87
|
+
var containerClassName = this.props.containerClassName;
|
|
88
|
+
var className = cn('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
|
|
87
89
|
var value = this.translateValue();
|
|
88
90
|
return /*#__PURE__*/React.createElement("div", {
|
|
89
91
|
className: className
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import { CellType } from '../constants';
|
|
7
7
|
import CheckboxFormatter from '../CheckboxFormatter';
|
|
8
8
|
import ImageFormatter from '../ImageFormatter';
|
|
9
|
-
import
|
|
9
|
+
import SimpleLongTextFormatter from '../SimpleLongTextFormatter';
|
|
10
10
|
import TextCellFormatter from '../TextFormatter';
|
|
11
11
|
import SingleSelectFormatter from '../SingleSelectFormatter';
|
|
12
12
|
import MultipleSelectFormatter from '../MultipleSelectFormatter';
|
|
@@ -27,5 +27,5 @@ import EmailFormatter from '../EmailFormatter';
|
|
|
27
27
|
import DurationFormatter from '../DurationFormatter';
|
|
28
28
|
import RateFormatter from '../RateFormatter';
|
|
29
29
|
import ButtonFormatter from '../ButtonFormatter';
|
|
30
|
-
var FormatterConfig = (_FormatterConfig = {}, _defineProperty(_FormatterConfig, CellType.DEFAULT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_FormatterConfig, CellType.TEXT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_FormatterConfig, CellType.CHECKBOX, /*#__PURE__*/React.createElement(CheckboxFormatter, null)), _defineProperty(_FormatterConfig, CellType.LONG_TEXT, /*#__PURE__*/React.createElement(
|
|
30
|
+
var FormatterConfig = (_FormatterConfig = {}, _defineProperty(_FormatterConfig, CellType.DEFAULT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_FormatterConfig, CellType.TEXT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_FormatterConfig, CellType.CHECKBOX, /*#__PURE__*/React.createElement(CheckboxFormatter, null)), _defineProperty(_FormatterConfig, CellType.LONG_TEXT, /*#__PURE__*/React.createElement(SimpleLongTextFormatter, null)), _defineProperty(_FormatterConfig, CellType.SINGLE_SELECT, /*#__PURE__*/React.createElement(SingleSelectFormatter, null)), _defineProperty(_FormatterConfig, CellType.IMAGE, /*#__PURE__*/React.createElement(ImageFormatter, null)), _defineProperty(_FormatterConfig, CellType.FILE, /*#__PURE__*/React.createElement(FileFormatter, null)), _defineProperty(_FormatterConfig, CellType.MULTIPLE_SELECT, /*#__PURE__*/React.createElement(MultipleSelectFormatter, null)), _defineProperty(_FormatterConfig, CellType.COLLABORATOR, /*#__PURE__*/React.createElement(CollaboratorFormatter, null)), _defineProperty(_FormatterConfig, CellType.NUMBER, /*#__PURE__*/React.createElement(NumberFormatter, null)), _defineProperty(_FormatterConfig, CellType.DATE, /*#__PURE__*/React.createElement(DateFormatter, null)), _defineProperty(_FormatterConfig, CellType.LINK, /*#__PURE__*/React.createElement(LinkFormatter, null)), _defineProperty(_FormatterConfig, CellType.CREATOR, /*#__PURE__*/React.createElement(CreatorFormatter, null)), _defineProperty(_FormatterConfig, CellType.CTIME, /*#__PURE__*/React.createElement(CTimeFormatter, null)), _defineProperty(_FormatterConfig, CellType.LAST_MODIFIER, /*#__PURE__*/React.createElement(LastModifierFormatter, null)), _defineProperty(_FormatterConfig, CellType.MTIME, /*#__PURE__*/React.createElement(MTimeFormatter, null)), _defineProperty(_FormatterConfig, CellType.GEOLOCATION, /*#__PURE__*/React.createElement(GeolocationFormatter, null)), _defineProperty(_FormatterConfig, CellType.FORMULA, /*#__PURE__*/React.createElement(FormulaFormatter, null)), _defineProperty(_FormatterConfig, CellType.AUTO_NUMBER, /*#__PURE__*/React.createElement(AutoNumberFormatter, null)), _defineProperty(_FormatterConfig, CellType.URL, /*#__PURE__*/React.createElement(UrlFormatter, null)), _defineProperty(_FormatterConfig, CellType.EMAIL, /*#__PURE__*/React.createElement(EmailFormatter, null)), _defineProperty(_FormatterConfig, CellType.DURATION, /*#__PURE__*/React.createElement(DurationFormatter, null)), _defineProperty(_FormatterConfig, CellType.RATE, /*#__PURE__*/React.createElement(RateFormatter, null)), _defineProperty(_FormatterConfig, CellType.BUTTON, /*#__PURE__*/React.createElement(ButtonFormatter, null)), _FormatterConfig);
|
|
31
31
|
export default FormatterConfig;
|
|
@@ -180,19 +180,15 @@ export var getDateDisplayString = function getDateDisplayString(value, format) {
|
|
|
180
180
|
return "".concat(formatDateList[2], "/").concat(formatDateList[1], "/").concat(formatDateList[0], " ").concat(formatValuesList[1]);
|
|
181
181
|
|
|
182
182
|
case 'M/D/YYYY':
|
|
183
|
-
return date.format('M/D/YYYY');
|
|
184
|
-
|
|
185
183
|
case 'M/D/YYYY HH:mm':
|
|
186
|
-
return date.format('M/D/YYYY HH:mm');
|
|
187
|
-
|
|
188
184
|
case 'YYYY-MM-DD':
|
|
189
|
-
return date.format('YYYY-MM-DD');
|
|
190
|
-
|
|
191
185
|
case 'YYYY-MM-DD HH:mm':
|
|
192
|
-
|
|
186
|
+
case 'DD.MM.YYYY':
|
|
187
|
+
case 'DD.MM.YYYY HH:mm':
|
|
188
|
+
return date.format(format);
|
|
193
189
|
|
|
194
190
|
default:
|
|
195
|
-
return
|
|
191
|
+
return date.format('YYYY-MM-DD');
|
|
196
192
|
}
|
|
197
193
|
};
|
|
198
194
|
export var getDurationDisplayString = function getDurationDisplayString(value, duration_format) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"main": "./
|
|
3
|
+
"version": "0.1.78",
|
|
4
|
+
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "0.0.9",
|
|
7
7
|
"@seafile/seafile-calendar": "0.0.15",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"hast-util-to-html": "3.1.0",
|
|
17
17
|
"is-hotkey": "^0.1.6",
|
|
18
18
|
"moment": "^2.26.0",
|
|
19
|
-
"react": "
|
|
19
|
+
"react": "16.14.0",
|
|
20
20
|
"react-app-polyfill": "^1.0.6",
|
|
21
|
-
"react-dom": "
|
|
21
|
+
"react-dom": "16.14.0",
|
|
22
22
|
"react-responsive": "^8.0.3",
|
|
23
23
|
"react-transition-group": "^4.4.1",
|
|
24
24
|
"reactstrap": "^8.4.1",
|