@seafile/sdoc-editor 1.0.4 → 1.0.5

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.
@@ -1,5 +1,6 @@
1
- import React, { useState } from 'react';
1
+ import React, { useCallback, useState } from 'react';
2
2
  import { ElementPopover } from '../../../commons';
3
+ import TableSettings from '../seatable-settings';
3
4
  import './index.css';
4
5
  export default function OpMenu(_ref) {
5
6
  let {
@@ -7,11 +8,23 @@ export default function OpMenu(_ref) {
7
8
  element,
8
9
  menuPosition
9
10
  } = _ref;
10
- const [isShowSettingPanel, setIsShowSettingPanel] = useState(false);
11
+ const [isShowSeaTableSetting, setIsShowSeaTableSetting] = useState(false);
12
+ const onShowSettings = useCallback(() => {
13
+ setIsShowSeaTableSetting(true);
14
+ }, []);
15
+ const onHideSettings = useCallback(() => {
16
+ setIsShowSeaTableSetting(false);
17
+ }, []);
18
+ console.log(isShowSeaTableSetting);
11
19
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ElementPopover, null, /*#__PURE__*/React.createElement("div", {
12
20
  className: "seatable-op-menu",
13
21
  style: menuPosition
14
22
  }, /*#__PURE__*/React.createElement("span", {
15
- className: "sdocfont sdoc-settings"
16
- }))));
23
+ className: "sdocfont sdoc-settings",
24
+ onClick: onShowSettings
25
+ }))), isShowSeaTableSetting && /*#__PURE__*/React.createElement(TableSettings, {
26
+ editor: editor,
27
+ element: element,
28
+ onHideSettings: onHideSettings
29
+ }));
17
30
  }
@@ -0,0 +1,28 @@
1
+ .document-plugin .widget-table-switch-properties .custom-switch-description {
2
+ margin-left: 0;
3
+ white-space: normal;
4
+ flex: 1;
5
+ margin-right: .5rem;
6
+ }
7
+
8
+ .document-plugin .widget-table-switch-properties .custom-switch {
9
+ width: 100%;
10
+ justify-content: space-between;
11
+ cursor: pointer;
12
+ padding-left: 0;
13
+ }
14
+
15
+ .document-plugin .widget-table-switch-properties .custom-switch-indicator {
16
+ width: 22px;
17
+ height: 12px;
18
+ flex-shrink: 0;
19
+ }
20
+
21
+ .document-plugin .widget-table-switch-properties .custom-switch-indicator:before {
22
+ height: 8px;
23
+ width: 8px;
24
+ }
25
+
26
+ .document-plugin .widget-table-switch-properties .custom-switch-input:checked~.custom-switch-indicator:before {
27
+ left: 12px;
28
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { DTableSwitch } from 'dtable-ui-component';
3
+ import './index.css';
4
+ function CustomSwitch(props) {
5
+ const {
6
+ isLocked,
7
+ checked,
8
+ title
9
+ } = props;
10
+ return /*#__PURE__*/React.createElement(DTableSwitch, {
11
+ checked: checked,
12
+ disabled: isLocked,
13
+ switchClassName: "widget-table-switch-properties w-100",
14
+ placeholder: title,
15
+ onChange: () => props.onPropertiesChanged(!checked)
16
+ });
17
+ }
18
+ export default CustomSwitch;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export default function FilterSetter() {
3
+ return /*#__PURE__*/React.createElement("div", {
4
+ className: "setting-item-btn filters-setting"
5
+ }, /*#__PURE__*/React.createElement("i", {
6
+ className: "dtable-font dtable-icon-filter mr-2"
7
+ }), /*#__PURE__*/React.createElement("div", null, "FilterSetter"));
8
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export default function HideColumnSetter() {
3
+ return /*#__PURE__*/React.createElement("div", {
4
+ className: "setting-item-btn columns-setting"
5
+ }, /*#__PURE__*/React.createElement("i", {
6
+ className: "dtable-font dtable-icon-hide mr-2"
7
+ }), /*#__PURE__*/React.createElement("div", null, "Hide column setter"));
8
+ }
@@ -0,0 +1,66 @@
1
+ .document-seatable-settings-wrapper {
2
+ position: fixed;
3
+ right: 0;
4
+ top: 200px;
5
+ width: 300px;
6
+ bottom: 0;
7
+ background-color: #fff;
8
+ border-left: 1px solid #e4e4e4;
9
+ transition: width .25s ease-in-out 0s;
10
+ z-index: 4;
11
+ display: flex;
12
+ }
13
+
14
+ .document-seatable-settings-container {
15
+ display: flex;
16
+ flex: 1 1;
17
+ flex-direction: column;
18
+ min-height: 0;
19
+ min-width: 0;
20
+ }
21
+
22
+ .document-seatable-settings-container .document-seatable-settings-header {
23
+ height: 48px;
24
+ line-height: 48px;
25
+ padding: 0 16px;
26
+ display: flex;
27
+ justify-content: space-between;
28
+ border-bottom: 1px solid #e4e4e4;
29
+ }
30
+
31
+ .document-seatable-settings-container .document-seatable-settings-content {
32
+ height: calc(100% - 49px);
33
+ overflow: auto;
34
+ width: 100%;
35
+ display: flex;
36
+ flex-direction: column;
37
+ padding: 16px 16px 50px;
38
+ }
39
+
40
+ .document-plugin .document-seatable-settings-container .setting-item {
41
+ margin: 0;
42
+ margin-bottom: 1rem;
43
+ }
44
+
45
+ .document-plugin .document-seatable-settings-container .setting-divide-line {
46
+ border-bottom: 1px solid #e2e2e2;
47
+ margin: 14px 0;
48
+ }
49
+
50
+ .document-plugin .document-seatable-settings-container .setting-item.table-setting {
51
+ margin-bottom: 0;
52
+ }
53
+
54
+ .document-plugin .document-seatable-settings-container .setting-item-btn {
55
+ display: flex;
56
+ border-radius: 4px;
57
+ cursor: pointer;
58
+ line-height: 22px;
59
+ padding: 3px 4px;
60
+ width: 100%;
61
+ }
62
+
63
+ .document-plugin .document-seatable-settings-container .setting-item-btn .dtable-font {
64
+ color: #666;
65
+ font-size: 14px;
66
+ }
@@ -0,0 +1,73 @@
1
+ import React, { useCallback, useState } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import CustomSwitch from './custom-switch';
4
+ import './index.css';
5
+ import TableSetting from './table-setting';
6
+ import FilterSetter from './filter-setter';
7
+ import SortSetter from './sort-setter';
8
+ import HideColumnSetter from './hide-column-setter';
9
+ export default function TableSettings(_ref) {
10
+ let {
11
+ editor,
12
+ element,
13
+ onHideSettings
14
+ } = _ref;
15
+ const [settings, updateSettings] = useState(element);
16
+ const {
17
+ t
18
+ } = useTranslation();
19
+ const onTableChange = useCallback(option => {
20
+ console.log(option);
21
+ }, []);
22
+ return /*#__PURE__*/React.createElement("div", {
23
+ className: "document-seatable-settings-wrapper"
24
+ }, /*#__PURE__*/React.createElement("div", {
25
+ className: "document-seatable-settings-container"
26
+ }, /*#__PURE__*/React.createElement("div", {
27
+ className: "document-seatable-settings-header"
28
+ }, /*#__PURE__*/React.createElement("span", null, t('SeaTable_settings')), /*#__PURE__*/React.createElement("span", {
29
+ className: "dtable-font dtable-icon-x",
30
+ onClick: onHideSettings
31
+ })), /*#__PURE__*/React.createElement("div", {
32
+ className: "document-seatable-settings-content"
33
+ }, /*#__PURE__*/React.createElement(TableSetting, {
34
+ tables: editor.tables,
35
+ element: settings,
36
+ onTableChange: onTableChange
37
+ }), /*#__PURE__*/React.createElement("div", {
38
+ class: "setting-divide-line"
39
+ }), /*#__PURE__*/React.createElement("div", {
40
+ className: "setting-item"
41
+ }, "Data settings"), /*#__PURE__*/React.createElement("div", {
42
+ className: "setting-item filter-setter"
43
+ }, /*#__PURE__*/React.createElement(FilterSetter, null)), /*#__PURE__*/React.createElement("div", {
44
+ className: "setting-item sort-setter"
45
+ }, /*#__PURE__*/React.createElement(SortSetter, null)), /*#__PURE__*/React.createElement("div", {
46
+ className: "setting-item hide-column-setter"
47
+ }, /*#__PURE__*/React.createElement(HideColumnSetter, null)), /*#__PURE__*/React.createElement("div", {
48
+ class: "setting-divide-line"
49
+ }), /*#__PURE__*/React.createElement("div", {
50
+ className: "setting-item"
51
+ }, "Style Settings"), /*#__PURE__*/React.createElement("div", {
52
+ className: "setting-item"
53
+ }, /*#__PURE__*/React.createElement(CustomSwitch, {
54
+ checked: settings['show_record_numbers'],
55
+ isLocked: false,
56
+ title: t('Show_record_numbers'),
57
+ onPropertiesChanged: value => this.onSwitchPropertiesChanged('showRowNumber', value)
58
+ })), /*#__PURE__*/React.createElement("div", {
59
+ className: "setting-item"
60
+ }, /*#__PURE__*/React.createElement(CustomSwitch, {
61
+ checked: settings['alternate_color'],
62
+ isLocked: false,
63
+ title: t('Alternate_color'),
64
+ onPropertiesChanged: value => this.onSwitchPropertiesChanged('applyBandedTableDesign', value)
65
+ })), /*#__PURE__*/React.createElement("div", {
66
+ className: "setting-item"
67
+ }, /*#__PURE__*/React.createElement(CustomSwitch, {
68
+ checked: settings['select_column_display_option_color'] === false ? false : true,
69
+ isLocked: false,
70
+ title: t('Select_column_display_option_color_tip'),
71
+ onPropertiesChanged: value => this.onSwitchPropertiesChanged('select_column_display_option_color', value)
72
+ })))));
73
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export default function SortSetter() {
3
+ return /*#__PURE__*/React.createElement("div", {
4
+ className: "setting-item-btn sorts-setting"
5
+ }, /*#__PURE__*/React.createElement("i", {
6
+ className: "dtable-font dtable-icon-sort mr-2"
7
+ }), /*#__PURE__*/React.createElement("div", null, "Sort setter"));
8
+ }
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { withTranslation } from 'react-i18next';
3
+ import { Label } from 'reactstrap';
4
+ import { DTableSelect } from 'dtable-ui-component';
5
+ class TableSetting extends React.Component {
6
+ render() {
7
+ const {
8
+ tables,
9
+ element,
10
+ t
11
+ } = this.props;
12
+ const {
13
+ table_id
14
+ } = element;
15
+ const options = tables.map(item => {
16
+ let value = item._id;
17
+ let label = item.name;
18
+ return {
19
+ value,
20
+ label
21
+ };
22
+ });
23
+ let selectedOption;
24
+ if (table_id) {
25
+ selectedOption = options.find(option => option.value === table_id);
26
+ }
27
+ if (!selectedOption) {
28
+ selectedOption = options[0];
29
+ }
30
+ return /*#__PURE__*/React.createElement("div", {
31
+ className: "setting-item table-setting"
32
+ }, /*#__PURE__*/React.createElement(Label, null, t('Table')), /*#__PURE__*/React.createElement(DTableSelect, {
33
+ value: selectedOption,
34
+ options: options,
35
+ onChange: this.props.onTableChange,
36
+ menuPortalTarget: "element-settings"
37
+ }));
38
+ }
39
+ }
40
+ export default withTranslation('sdoc-editor')(TableSetting);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -463,6 +463,9 @@
463
463
  "Horizontal_align": "Горизонтальное выравнивание",
464
464
  "SeaTable_column": "Столбец SeaTable",
465
465
  "SeaTable_table": "Таблица SeaTable",
466
- "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
466
+ "And_x_more_records": "и ещё {{count}} записей",
467
+ "Print_limit_exceeded": "При превышении лимита печати будут напечатаны только первые 200 строк",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable 列",
465
465
  "SeaTable_table": "SeaTable 子表",
466
466
  "And_x_more_records": "以及另外 {{count}} 条记录",
467
- "Print_limit_exceeded": "超过打印限制, 只会打印前 200 行"
467
+ "Print_limit_exceeded": "超过打印限制, 只会打印前 200 行",
468
+ "Show_record_numbers": "显示记录编号",
469
+ "Alternate_color": "单双行不同背景色",
470
+ "Select_column_display_option_color_tip": "单选列和多选列显示选项颜色"
468
471
  }