@ctzy-web-client/data-model 1.0.4 → 1.0.6

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.
Files changed (51) hide show
  1. package/package.json +33 -33
  2. package/es/SimpleOrm.mjs +0 -85
  3. package/es/_virtual/_rollupPluginBabelHelpers.mjs +0 -2830
  4. package/es/abstract/DataColumn.mjs +0 -65
  5. package/es/abstract/DataForm.mjs +0 -178
  6. package/es/abstract/DataModel.mjs +0 -223
  7. package/es/abstract/DataModelAdapter.mjs +0 -86
  8. package/es/abstract/DataTable.mjs +0 -339
  9. package/es/abstract/FilterColumn.mjs +0 -44
  10. package/es/abstract/FilterPanel.mjs +0 -392
  11. package/es/abstract/FormColumn.mjs +0 -27
  12. package/es/abstract/TableColumn.mjs +0 -34
  13. package/es/abstract/dataForm2.mjs +0 -178
  14. package/es/abstract/where/CombineCondition.mjs +0 -63
  15. package/es/abstract/where/Condition.mjs +0 -4
  16. package/es/abstract/where/SingleCondition.mjs +0 -22
  17. package/es/abstract/where/Where.mjs +0 -21
  18. package/es/decorator/constant.mjs +0 -11
  19. package/es/decorator/dataForm.mjs +0 -18
  20. package/es/decorator/dataTable.mjs +0 -18
  21. package/es/decorator/filterColumn.mjs +0 -21
  22. package/es/decorator/formColumn.mjs +0 -19
  23. package/es/decorator/tableColumn.mjs +0 -20
  24. package/es/factory.mjs +0 -14
  25. package/es/index.mjs +0 -14
  26. package/es/utils/index.mjs +0 -15
  27. package/lib/SimpleOrm.js +0 -89
  28. package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -2948
  29. package/lib/abstract/DataColumn.js +0 -69
  30. package/lib/abstract/DataForm.js +0 -186
  31. package/lib/abstract/DataModel.js +0 -231
  32. package/lib/abstract/DataModelAdapter.js +0 -90
  33. package/lib/abstract/DataTable.js +0 -343
  34. package/lib/abstract/FilterColumn.js +0 -48
  35. package/lib/abstract/FilterPanel.js +0 -396
  36. package/lib/abstract/FormColumn.js +0 -31
  37. package/lib/abstract/TableColumn.js +0 -38
  38. package/lib/abstract/dataForm2.js +0 -186
  39. package/lib/abstract/where/CombineCondition.js +0 -67
  40. package/lib/abstract/where/Condition.js +0 -8
  41. package/lib/abstract/where/SingleCondition.js +0 -26
  42. package/lib/abstract/where/Where.js +0 -25
  43. package/lib/decorator/constant.js +0 -20
  44. package/lib/decorator/dataForm.js +0 -22
  45. package/lib/decorator/dataTable.js +0 -22
  46. package/lib/decorator/filterColumn.js +0 -25
  47. package/lib/decorator/formColumn.js +0 -23
  48. package/lib/decorator/tableColumn.js +0 -24
  49. package/lib/factory.js +0 -19
  50. package/lib/index.js +0 -36
  51. package/lib/utils/index.js +0 -19
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "@ctzy-web-client/data-model",
3
- "version": "1.0.4",
4
- "description": "",
5
- "main": "lib/index.js",
6
- "module": "es/index.mjs",
7
- "exports": {
8
- ".": {
9
- "require": "./lib/index.js",
10
- "import": "./es/index.mjs"
11
- },
12
- "./src": "./src/index.js",
13
- "./src/*": "./src/*",
14
- "./es": "./es/index.mjs",
15
- "./lib": "./lib/index.js",
16
- "./es/*": "./es/*",
17
- "./lib/*": "./lib/*"
18
- },
19
- "scripts": {
20
- "test": "echo \"Error: no test specified\" && exit 1"
21
- },
22
- "keywords": [],
23
- "author": "",
24
- "license": "ISC",
25
- "dependencies": {
26
- "@types/lodash": "^4.14.188",
27
- "@ctzy-web-client/ioc": "workspace:^1.0.0",
28
- "@ctzy-web-client/ioc-annotations": "workspace:^1.0.0",
29
- "@ctzy-web-client/support": "workspace:^1.0.0",
30
- "lodash": "^4.17.21",
31
- "rxjs": "^7.6.0"
32
- }
33
- }
1
+ {
2
+ "name": "@ctzy-web-client/data-model",
3
+ "version": "1.0.6",
4
+ "description": "",
5
+ "main": "lib/index.js",
6
+ "module": "es/index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./lib/index.js",
10
+ "import": "./es/index.mjs"
11
+ },
12
+ "./src": "./src/index.js",
13
+ "./src/*": "./src/*",
14
+ "./es": "./es/index.mjs",
15
+ "./lib": "./lib/index.js",
16
+ "./es/*": "./es/*",
17
+ "./lib/*": "./lib/*"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "dependencies": {
23
+ "@types/lodash": "^4.14.188",
24
+ "@ctzy-web-client/ioc": "^1.0.0",
25
+ "@ctzy-web-client/ioc-annotations": "^1.0.0",
26
+ "@ctzy-web-client/support": "^1.0.0",
27
+ "lodash": "^4.17.21",
28
+ "rxjs": "^7.6.0"
29
+ },
30
+ "scripts": {
31
+ "test": "echo \"Error: no test specified\" && exit 1"
32
+ }
33
+ }
package/es/SimpleOrm.mjs DELETED
@@ -1,85 +0,0 @@
1
- import { initializerDefineProperty as _initializerDefineProperty, applyDecoratedDescriptor as _applyDecoratedDescriptor } from './_virtual/_rollupPluginBabelHelpers.mjs';
2
- import { inject } from '@ctzy-web-client/ioc-annotations';
3
- import { InstantiationService } from '@ctzy-web-client/ioc';
4
- import DataModelAdapter from './abstract/DataModelAdapter.mjs';
5
- import DataTable from './abstract/DataTable.mjs';
6
- import DataForm from './abstract/dataForm2.mjs';
7
-
8
- var _dec, _dec2, _class, _descriptor, _descriptor2;
9
- let SimpleOrm = (_dec = inject(DataModelAdapter), _dec2 = inject(InstantiationService), _class = class SimpleOrm2 {
10
- constructor() {
11
- _initializerDefineProperty(this, "adapter", _descriptor, this);
12
- _initializerDefineProperty(this, "instantiationService", _descriptor2, this);
13
- }
14
- createDataTable(model, options = {}) {
15
- return this.instantiationService.createInstance(DataTable, {
16
- args: [{
17
- model
18
- }]
19
- });
20
- }
21
- createDataForm(model, options = {}) {
22
- return this.instantiationService.createInstance(DataForm, {
23
- args: [{
24
- model
25
- }]
26
- });
27
- }
28
- async fill(classType, params2, maxRecCount = 1e4) {
29
- const dataTable = this.createDataForm(classType);
30
- return dataTable.adapter.loadDataListHandle(dataTable, Object.assign({
31
- [dataTable.adapter.pagerNumParamName]: 1,
32
- [dataTable.adapter.recCountParamName]: maxRecCount
33
- }, params2)).then((res) => {
34
- return res.data.map((dataItem) => {
35
- let modelInstance = new classType();
36
- dataTable.getColumns().forEach((column) => {
37
- modelInstance[column.attrName] = dataItem[column.name];
38
- });
39
- return modelInstance;
40
- });
41
- });
42
- }
43
- async first(classType, params2) {
44
- return this.fill(classType, params2, 1).then((data) => {
45
- return data[0] || null;
46
- });
47
- }
48
- async firstByRecId(classType, recId) {
49
- const dataTable = this.createDataTable(classType);
50
- return this.adapter.loadDataByRecIdHandle(dataTable, Object.assign({
51
- [this.primaryKey]: recId
52
- }, params)).then((data) => {
53
- const result = Array.isArray(data.data) ? data.data[0] : data.data;
54
- if (result) {
55
- let modelInstance = new classType();
56
- dataTable.getColumns().forEach((column) => {
57
- modelInstance[column.attrName] = result[column.name];
58
- });
59
- return modelInstance;
60
- }
61
- return result;
62
- });
63
- }
64
- submit(classType, data) {
65
- const dataForm = this.createDataForm(classType);
66
- dataForm.adapter = this.adapter;
67
- return dataForm.submit(data);
68
- }
69
- }, _descriptor = _applyDecoratedDescriptor(_class.prototype, "adapter", [_dec], {
70
- configurable: true,
71
- enumerable: true,
72
- writable: true,
73
- initializer: function() {
74
- return null;
75
- }
76
- }), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "instantiationService", [_dec2], {
77
- configurable: true,
78
- enumerable: true,
79
- writable: true,
80
- initializer: function() {
81
- return null;
82
- }
83
- }), _class);
84
-
85
- export { SimpleOrm as default };