json-server-client
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -38,6 +38,7 @@ "use strict"; | ||
const [name, setName] = react_1.useState(rawname); | ||
const isTable = react_1.useMemo(() => db[name] instanceof json_server_orm_1.Table, [name]); | ||
const isTable = react_1.useMemo(() => db[name].isPlural, [name]); | ||
console.log('[client.Client]', isTable, json_server_orm_1.Table, db[name]); | ||
const [limit, setLimit] = react_1.useState(10); | ||
const [q, setQ] = react_1.useState(''); | ||
log_1.log('[App] begin', name, isTable ? 'table' : 'object'); | ||
log_1.log('[client.Client] begin', name, isTable ? 'table' : 'object'); | ||
return react_1.default.createElement(react_1.default.Fragment, null, | ||
@@ -44,0 +45,0 @@ react_1.default.createElement("div", { className: 'panel' }, |
@@ -42,5 +42,5 @@ "use strict"; | ||
try { | ||
log_1.log('[EditableRow.handleClick]', item); | ||
log_1.log('[client.EditableRow.handleClick]', item); | ||
const newItem = editItem ? await dbTable.update(item) : await dbTable.add(item); | ||
log_1.log('[EditableRow.handleClick] newItem', newItem); | ||
log_1.log('[client.EditableRow.handleClick] newItem', newItem); | ||
onSubmit && onSubmit(newItem); | ||
@@ -72,3 +72,2 @@ } | ||
const handleChange = (ev) => { | ||
// console.log('handleChange', ev.target.value); | ||
const type = ps[f].type; | ||
@@ -91,3 +90,2 @@ switch (type) { | ||
const handleBlur = (ev) => { | ||
// console.log('handleBlur', ev.target.value); | ||
const f = ev.target.name; | ||
@@ -94,0 +92,0 @@ const type = ps[f].type; |
@@ -35,3 +35,3 @@ "use strict"; | ||
const obj = await dbObject.one(); | ||
log_1.log('[Object]', obj); | ||
log_1.log('[client.Object]', obj); | ||
setObject(obj); | ||
@@ -61,3 +61,2 @@ setEditable(false); | ||
const o = await dbObject.update(obj, true); | ||
console.log(o); | ||
onSubmit && onSubmit(o); | ||
@@ -64,0 +63,0 @@ } |
@@ -35,3 +35,3 @@ "use strict"; | ||
const id = item.id; | ||
log_1.log('[Row.handleDelete]', id); | ||
log_1.log('[client.Row.handleDelete]', id); | ||
await dbTable.delete(id); | ||
@@ -38,0 +38,0 @@ onDelete && onDelete(id); |
@@ -51,3 +51,3 @@ "use strict"; | ||
const its = await dbTable.all(opts); | ||
log_1.log(`[Table] ${its.length} items loaded, opts`, opts); | ||
log_1.log(`[client.Table] ${its.length} items loaded, opts`, opts); | ||
setItems(its); | ||
@@ -54,0 +54,0 @@ setCount(await dbTable.count()); |
{ | ||
"name": "json-server-client", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -8,7 +8,5 @@ "author": "luics.xu@gmail.com", | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"types": "lib/index.d.js", | ||
"files": [ | ||
"lib", | ||
"esm" | ||
"lib" | ||
], | ||
@@ -21,6 +19,5 @@ "keywords": [ | ||
"scripts": { | ||
"build": "run-s clean build:cjs build:esm", | ||
"build": "run-s clean build:cjs", | ||
"build:cjs": "tsc -p tsconfig.cjs.json", | ||
"build:esm": "tsc -p tsconfig.esm.json", | ||
"clean": "rm -rf ./lib ./esm && mkdir ./lib ./esm", | ||
"clean": "rm -rf ./lib && mkdir ./lib", | ||
"start": "npm run clean && webpack serve --mode development", | ||
@@ -31,4 +28,3 @@ "test": "mocha -r ts-node/register test/*/*.spec.ts", | ||
"lint": "eslint \"{src,test}/**/*.{ts,tsx,js}\"", | ||
"post-install": "echo 'npm run precommit' > .git/hooks/pre-commit && chmod 777 .git/hooks/pre-commit", | ||
"precommit": "#npm run lint && npm test" | ||
"prepublish": "npm run lint && npm run build" | ||
}, | ||
@@ -35,0 +31,0 @@ "engines": { |
@@ -14,8 +14,5 @@ # json-server-client | ||
### features | ||
0. TODO publish: | ||
0. export from webpack | ||
0. //input: schema.ts | ||
0. //init: generate schema.json | ||
0. //export: App | ||
0. //test: `ReactDOM.render(<App />, document.getElementById('root'))`; | ||
0. TODO publish: npm link, tow react, https://stackoverflow.com/a/63705440/1835843 | ||
0. FIXME isTable not works | ||
0. TODO publish: export scss from webpack | ||
0. TODO [understanding-json-schema](https://json-schema.org/understanding-json-schema/index.html) | ||
@@ -26,2 +23,6 @@ 0. TODO [express](http://expressjs.com/en/4x/api.html#res) | ||
0. //input: schema.ts | ||
0. //init: generate schema.json | ||
0. //export: App | ||
0. //test: `ReactDOM.render(<App />, document.getElementById('root'))`; | ||
0. //object edit, text area or json editor | ||
@@ -28,0 +29,0 @@ 0. //seperate json-server-orm |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57
31329
22
631