-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add file ledger apis * remove apis about export ledgers * opt code struct * feat: update api * feat: update code * rename init-ledger script -> init-extended-props * remove useless code * POST/PUT extended-props return row * return default some fields when extended-row not exists * feat: update seafile-js version --------- Co-authored-by: er-pai-r <[email protected]>
- Loading branch information
1 parent
e97b0c2
commit 0a7aeec
Showing
32 changed files
with
2,330 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,5 @@ frontend/package-lock.json | |
frontend/.eslintcache | ||
|
||
/.idea | ||
|
||
.vscode |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
frontend/src/components/dialog/extra-attributes-dialog/column/column-name.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Col } from 'reactstrap'; | ||
|
||
function ColumnName(props) { | ||
const { column } = props; | ||
const { name } = column; | ||
|
||
return ( | ||
<Col md={3} className="d-flex column-name"> | ||
<div className="w-100 text-truncate"> | ||
{name || ''} | ||
</div> | ||
</Col> | ||
); | ||
} | ||
|
||
ColumnName.propTypes = { | ||
column: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default ColumnName; |
7 changes: 7 additions & 0 deletions
7
frontend/src/components/dialog/extra-attributes-dialog/column/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.extra-attributes-dialog .column-name { | ||
padding-top: 9px; | ||
} | ||
|
||
.extra-attributes-dialog .column-item { | ||
min-height: 56px; | ||
} |
37 changes: 37 additions & 0 deletions
37
frontend/src/components/dialog/extra-attributes-dialog/column/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Col } from 'reactstrap'; | ||
import ColumnName from './column-name'; | ||
import CONFIG from '../editor'; | ||
|
||
import './index.css'; | ||
|
||
class Column extends Component { | ||
render() { | ||
const { column, row, columns } = this.props; | ||
const Editor = CONFIG[column.type] || CONFIG['text']; | ||
|
||
return ( | ||
<div className="pb-4 row column-item"> | ||
<ColumnName column={column} /> | ||
<Col md={9} className='d-flex align-items-center extra-attribute-item-info'> | ||
<Editor | ||
column={column} | ||
row={row} | ||
columns={columns} | ||
onCommit={this.props.onCommit} | ||
/> | ||
</Col> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
Column.propTypes = { | ||
column: PropTypes.object, | ||
row: PropTypes.object, | ||
columns: PropTypes.array, | ||
onCommit: PropTypes.func, | ||
}; | ||
|
||
export default Column; |
22 changes: 22 additions & 0 deletions
22
frontend/src/components/dialog/extra-attributes-dialog/editor/ctime-formatter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { getDateDisplayString } from '../../../../utils/extra-attributes'; | ||
|
||
class CtimeFormatter extends Component { | ||
render() { | ||
const { column, row } = this.props; | ||
const { key } = column; | ||
const value = getDateDisplayString(row[key], 'YYYY-MM-DD HH:mm:ss') || ''; | ||
|
||
return ( | ||
<div className="form-control" style={{ width: 320 }}>{value}</div> | ||
); | ||
} | ||
} | ||
|
||
CtimeFormatter.propTypes = { | ||
column: PropTypes.object, | ||
row: PropTypes.object, | ||
}; | ||
|
||
export default CtimeFormatter; |
28 changes: 28 additions & 0 deletions
28
frontend/src/components/dialog/extra-attributes-dialog/editor/date-editor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { getDateDisplayString } from '../../../../utils/extra-attributes'; | ||
|
||
|
||
class DateEditor extends Component { | ||
render() { | ||
const { column, row } = this.props; | ||
const { data, key } = column; | ||
const value = getDateDisplayString(row[key], data ? data.format : ''); | ||
|
||
return ( | ||
<input | ||
type="text" | ||
className="form-control" | ||
value={value} | ||
disabled={true} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
DateEditor.propTypes = { | ||
column: PropTypes.object, | ||
row: PropTypes.object, | ||
}; | ||
|
||
export default DateEditor; |
31 changes: 31 additions & 0 deletions
31
frontend/src/components/dialog/extra-attributes-dialog/editor/formula-formatter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { FORMULA_RESULT_TYPE } from '../../../../constants'; | ||
import { getDateDisplayString } from '../../../../utils/extra-attributes'; | ||
|
||
function FormulaFormatter(props) { | ||
const { column, row } = props; | ||
const value = row[column.key]; | ||
|
||
const { data } = column; | ||
const { result_type, format } = data || {}; | ||
if (result_type === FORMULA_RESULT_TYPE.DATE) { | ||
return ( | ||
<div className="form-control disabled">{getDateDisplayString(value, format)}</div> | ||
); | ||
} | ||
if (result_type === FORMULA_RESULT_TYPE.STRING) { | ||
return value; | ||
} | ||
if (typeof value === 'object') { | ||
return null; | ||
} | ||
return <></>; | ||
} | ||
|
||
FormulaFormatter.propTypes = { | ||
column: PropTypes.object, | ||
row: PropTypes.object, | ||
}; | ||
|
||
export default FormulaFormatter; |
20 changes: 20 additions & 0 deletions
20
frontend/src/components/dialog/extra-attributes-dialog/editor/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import SimpleText from './simple-text'; | ||
import FormulaFormatter from './formula-formatter'; | ||
import SingleSelect from './single-select'; | ||
import NumberEditor from './number-editor'; | ||
import DateEditor from './date-editor'; | ||
import CtimeFormatter from './ctime-formatter'; | ||
import { EXTRA_ATTRIBUTES_COLUMN_TYPE } from '../../../../constants'; | ||
|
||
|
||
const CONFIG = { | ||
[EXTRA_ATTRIBUTES_COLUMN_TYPE.TEXT]: SimpleText, | ||
[EXTRA_ATTRIBUTES_COLUMN_TYPE.FORMULA]: FormulaFormatter, | ||
[EXTRA_ATTRIBUTES_COLUMN_TYPE.SINGLE_SELECT]: SingleSelect, | ||
[EXTRA_ATTRIBUTES_COLUMN_TYPE.NUMBER]: NumberEditor, | ||
[EXTRA_ATTRIBUTES_COLUMN_TYPE.DATE]: DateEditor, | ||
[EXTRA_ATTRIBUTES_COLUMN_TYPE.CTIME]: CtimeFormatter, | ||
[EXTRA_ATTRIBUTES_COLUMN_TYPE.MTIME]: CtimeFormatter, | ||
}; | ||
|
||
export default CONFIG; |
Oops, something went wrong.