Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mobx-restful-table",
"version": "1.1.0",
"version": "1.1.1",
"license": "LGPL-3.0",
"author": "shiy2008@gmail.com",
"description": "A Pagination Table & Scroll List component suite for CRUD operation, which is based on MobX RESTful & React.",
Expand Down Expand Up @@ -29,13 +29,14 @@
"@swc/helpers": "^0.5.1",
"classnames": "^2.3.2",
"lodash": "^4.17.21",
"mobx-react-helper": "^0.2.0",
"react-bootstrap": "^2.8.0",
"regenerator-runtime": "^0.14.0",
"web-utility": "^4.1.0"
},
"peerDependencies": {
"mobx": ">=4",
"mobx-i18n": "^0.4.0-rc.0",
"mobx-i18n": "^0.4",
"mobx-react": ">=6",
"mobx-restful": "^0.6",
"react": ">=16.8"
Expand All @@ -44,19 +45,19 @@
"@parcel/packager-ts": "~2.9.3",
"@parcel/transformer-typescript-types": "~2.9.3",
"@types/lodash": "^4.14.197",
"@types/react": "^18.2.20",
"@types/react": "^18.2.21",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"mobx": "^6.10.0",
"mobx-i18n": "^0.4.0-rc.0",
"mobx-i18n": "^0.4.0",
"mobx-react": "^9.0.0",
"mobx-restful": "^0.6.6",
"mobx-restful": "^0.6.10",
"parcel": "~2.9.3",
"prettier": "^3.0.2",
"react": "^18.2.0",
"typedoc": "^0.24.8",
"typedoc-plugin-mdn-links": "^3.0.3",
"typescript": "~5.1.6"
"typedoc": "^0.25.0",
"typedoc-plugin-mdn-links": "^3.1.0",
"typescript": "~5.2.2"
},
"prettier": {
"singleQuote": true,
Expand Down
109 changes: 61 additions & 48 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions source/BadgeInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { computed, makeObservable, observable } from 'mobx';
import * as MobX from 'mobx';
import { observer } from 'mobx-react';
import { observePropsState } from 'mobx-react-helper';
import { InputHTMLAttributes, KeyboardEvent, PureComponent } from 'react';
import { Badge, CloseButton } from 'react-bootstrap';
import { isEmpty } from 'web-utility';
Expand All @@ -24,23 +25,25 @@ export interface BadgeInputProps
}

@observer
@observePropsState
export class BadgeInput extends PureComponent<BadgeInputProps> {
constructor(props: BadgeInputProps) {
super(props);

makeObservable?.(this);
MobX.makeObservable?.(this);
}

static match(type: string): type is BadgeInputProps['type'] {
return TextInputTypes.includes(type as BadgeInputProps['type']);
}

@observable
@MobX.observable
innerValue = this.props.defaultValue || [];

@computed
declare observedProps: BadgeInputProps;

@MobX.computed
get value() {
return this.props.value || this.innerValue;
return this.observedProps.value || this.innerValue;
}

handleInput = (event: KeyboardEvent<HTMLInputElement>) => {
Expand Down
Loading