@blaze-cms/plugin-data-ui 0.125.0-f-admin-updates.5 → 0.126.0-admin-updates.0

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.
package/CHANGELOG.md CHANGED
@@ -3,39 +3,101 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [0.125.0-f-admin-updates.5](https://github.com/thebyte9/blaze/compare/v0.125.0-f-admin-updates.4...v0.125.0-f-admin-updates.5) (2022-12-12)
6
+ # [0.126.0-admin-updates.0](https://github.com/thebyte9/blaze/compare/v0.125.2...v0.126.0-admin-updates.0) (2022-12-16)
7
7
 
8
- **Note:** Version bump only for package @blaze-cms/plugin-data-ui
9
8
 
9
+ ### Bug Fixes
10
10
 
11
+ * admin updates feedback ([0e69cbb](https://github.com/thebyte9/blaze/commit/0e69cbb0337df371c3e1cfc2f43c0d4ce666f33b))
12
+ * update snapshots ([c88c8be](https://github.com/thebyte9/blaze/commit/c88c8bec58af59a5707d15f5e212e6b515706676))
13
+ * update snapshots ([d490e17](https://github.com/thebyte9/blaze/commit/d490e1746d63ed5842799d15d6696c287f9b0d10))
11
14
 
12
15
 
16
+ ### Features
13
17
 
14
- # [0.125.0-f-admin-updates.3](https://github.com/thebyte9/blaze/compare/v0.125.0-f-admin-updates.2...v0.125.0-f-admin-updates.3) (2022-11-10)
18
+ * add admin style feedback ([3f8b9a1](https://github.com/thebyte9/blaze/commit/3f8b9a1416a8a7977631583cff62fddb43cd2e9d))
19
+ * style sidebar and add updated snapshots. Bz2 2870 ([#3539](https://github.com/thebyte9/blaze/issues/3539)) ([60640e5](https://github.com/thebyte9/blaze/commit/60640e5b65b4ed426ceefabc00c3beddb2113676))
15
20
 
16
21
 
17
- ### Bug Fixes
18
22
 
19
- * admin updates feedback ([0e69cbb](https://github.com/thebyte9/blaze/commit/0e69cbb0337df371c3e1cfc2f43c0d4ce666f33b))
20
- * update snapshots ([c88c8be](https://github.com/thebyte9/blaze/commit/c88c8bec58af59a5707d15f5e212e6b515706676))
21
23
 
22
24
 
25
+ # [0.125.0](https://github.com/thebyte9/blaze/compare/v0.125.0-alpha.18...v0.125.0) (2022-11-30)
23
26
 
27
+ **Note:** Version bump only for package @blaze-cms/plugin-data-ui
24
28
 
25
29
 
26
- # [0.125.0-f-admin-updates.0](https://github.com/thebyte9/blaze/compare/v0.124.1...v0.125.0-f-admin-updates.0) (2022-10-06)
27
30
 
28
31
 
29
- ### Bug Fixes
30
32
 
31
- * copy data from functionality ([#3567](https://github.com/thebyte9/blaze/issues/3567)) ([e3e1faf](https://github.com/thebyte9/blaze/commit/e3e1faf758661ac9e1555f1b3963f472c93edd36))
32
- * update snapshots ([d490e17](https://github.com/thebyte9/blaze/commit/d490e1746d63ed5842799d15d6696c287f9b0d10))
33
+ # [0.125.0-alpha.18](https://github.com/thebyte9/blaze/compare/v0.125.0-alpha.17...v0.125.0-alpha.18) (2022-11-28)
33
34
 
34
35
 
35
36
  ### Features
36
37
 
37
- * add admin style feedback ([3f8b9a1](https://github.com/thebyte9/blaze/commit/3f8b9a1416a8a7977631583cff62fddb43cd2e9d))
38
- * style sidebar and add updated snapshots. Bz2 2870 ([#3539](https://github.com/thebyte9/blaze/issues/3539)) ([60640e5](https://github.com/thebyte9/blaze/commit/60640e5b65b4ed426ceefabc00c3beddb2113676))
38
+ * add admin listing filter to allow filtering in admin listings ([ac862bf](https://github.com/thebyte9/blaze/commit/ac862bf64dc021b2618aa648545b873b7db2638e))
39
+
40
+
41
+
42
+
43
+
44
+ # [0.125.0-alpha.15](https://github.com/thebyte9/blaze/compare/v0.125.0-alpha.14...v0.125.0-alpha.15) (2022-11-16)
45
+
46
+
47
+ ### Features
48
+
49
+ * GroupContent components ([#3678](https://github.com/thebyte9/blaze/issues/3678)) ([b6f5c7e](https://github.com/thebyte9/blaze/commit/b6f5c7e6e5a03f2322f3d3c1568c9d42b33ede45))
50
+
51
+
52
+
53
+
54
+
55
+ # [0.125.0-alpha.14](https://github.com/thebyte9/blaze/compare/v0.125.0-alpha.13...v0.125.0-alpha.14) (2022-10-25)
56
+
57
+ **Note:** Version bump only for package @blaze-cms/plugin-data-ui
58
+
59
+
60
+
61
+
62
+
63
+ # [0.125.0-alpha.13](https://github.com/thebyte9/blaze/compare/v0.125.0-alpha.12...v0.125.0-alpha.13) (2022-10-24)
64
+
65
+ **Note:** Version bump only for package @blaze-cms/plugin-data-ui
66
+
67
+
68
+
69
+
70
+
71
+ # [0.125.0-alpha.7](https://github.com/thebyte9/blaze/compare/v0.125.0-alpha.6...v0.125.0-alpha.7) (2022-10-07)
72
+
73
+ **Note:** Version bump only for package @blaze-cms/plugin-data-ui
74
+
75
+
76
+
77
+
78
+
79
+ # [0.125.0-alpha.3](https://github.com/thebyte9/blaze/compare/v0.125.0-alpha.2...v0.125.0-alpha.3) (2022-09-27)
80
+
81
+ **Note:** Version bump only for package @blaze-cms/plugin-data-ui
82
+
83
+
84
+
85
+
86
+
87
+ # [0.125.0-alpha.1](https://github.com/thebyte9/blaze/compare/v0.125.0-alpha.0...v0.125.0-alpha.1) (2022-09-15)
88
+
89
+ **Note:** Version bump only for package @blaze-cms/plugin-data-ui
90
+
91
+
92
+
93
+
94
+
95
+ ## [0.124.2-alpha.0](https://github.com/thebyte9/blaze/compare/v0.124.1...v0.124.2-alpha.0) (2022-09-06)
96
+
97
+
98
+ ### Bug Fixes
99
+
100
+ * copy data from functionality ([#3567](https://github.com/thebyte9/blaze/issues/3567)) ([e3e1faf](https://github.com/thebyte9/blaze/commit/e3e1faf758661ac9e1555f1b3963f472c93edd36))
39
101
 
40
102
 
41
103
 
package/README.md CHANGED
@@ -5,4 +5,36 @@ Base files for a plugin
5
5
  ### Events emitted
6
6
  | key | Description | Argument |
7
7
  | ---------------------- | ------------------------------------------------- | ---------------------------------------------- |
8
- | load:custom:field:type | Add to the form builder lookup a new custom field | {type: 'text': component: unmountendComponent} |
8
+ | load:custom:field:type | Add to the form builder lookup a new custom field | {type: 'text': component: unmountendComponent} |
9
+
10
+
11
+
12
+ ## displayProperties
13
+
14
+ The `displayProperties` property can be set on entity schema in the api to provide extra information for how to format the way an entity is display. For example the following could be set on an entity
15
+ ```json
16
+ "displayProperties": {
17
+ "adminHeader": [
18
+ "firstname",
19
+ "lastname"
20
+ ],
21
+ "adminLabel": {
22
+ "main": [
23
+ "firstname",
24
+ "lastname"
25
+ ],
26
+ "sub": [
27
+ "group.name"
28
+ ]
29
+ },
30
+ "adminDefaultListingFilter": {
31
+ "firstname": {
32
+ "_exists": false
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ - adminDefaultListingFilter: this is a where query that will be passed to the api to filter records from the admin listing
39
+ - adminLabel: properties to build label when record is showing search listings
40
+ - adminHeader: properties to build admin header
@@ -47,8 +47,9 @@ var createNewListItem = function createNewListItem(_ref) {
47
47
  return [].concat((0, _toConsumableArray2["default"])(listingData), [result]);
48
48
  };
49
49
  exports.createNewListItem = createNewListItem;
50
- var updateListItems = function updateListItems(_ref2) {
51
- var listingData = _ref2.listingData,
50
+ var updateListItems = function updateListItems() {
51
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
52
+ listingData = _ref2.listingData,
52
53
  result = _ref2.result,
53
54
  id = _ref2.id;
54
55
  if (!listingData || !result || !id) throw new _coreErrors.BlazeError('Expected object with: listingData, result, id');
@@ -66,8 +67,9 @@ var updateListItems = function updateListItems(_ref2) {
66
67
  });
67
68
  };
68
69
  exports.updateListItems = updateListItems;
69
- var deleteFromListItems = function deleteFromListItems(_ref3) {
70
- var listingData = _ref3.listingData,
70
+ var deleteFromListItems = function deleteFromListItems() {
71
+ var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
72
+ listingData = _ref3.listingData,
71
73
  id = _ref3.id;
72
74
  if (!listingData || !id) throw new _coreErrors.BlazeError('Expected object with: listingData, id');
73
75
  return listingData.filter(function (_ref4) {
@@ -1 +1 @@
1
- {"version":3,"file":"data-mappers.js","names":["getPageName","displayProperties","entity","adminHeader","name","fieldId","id","reduce","acc","headerProperty","item","push","join","createNewListItem","listingData","result","updateListItems","BlazeError","map","mapperResult","Object","keys","forEach","key","deleteFromListItems","filter","itemId"],"sources":["../../../../src/components/EntityManager/utils/data-mappers.js"],"sourcesContent":["import { BlazeError } from '@blaze-cms/core-errors';\n\nconst getPageName = (displayProperties = {}, entity = {}) => {\n if (!displayProperties || !displayProperties.adminHeader) {\n const { name, id: fieldId } = entity;\n return name || fieldId || '';\n }\n\n const { adminHeader } = displayProperties;\n return adminHeader\n .reduce((acc, headerProperty) => {\n const item = entity[headerProperty];\n if (item) acc.push(item);\n return acc;\n }, [])\n .join(' ');\n};\n\nconst createNewListItem = ({ listingData, result }) => [...listingData, result];\n\nconst updateListItems = ({ listingData, result, id }) => {\n if (!listingData || !result || !id)\n throw new BlazeError('Expected object with: listingData, result, id');\n return listingData.map(item => {\n const mapperResult = { ...item };\n if (item.id === id) {\n Object.keys(item).forEach(key => {\n if (result[key] && key !== 'id') {\n mapperResult[key] = result[key];\n }\n });\n return mapperResult;\n }\n return mapperResult;\n });\n};\n\nconst deleteFromListItems = ({ listingData, id }) => {\n if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');\n return listingData.filter(({ id: itemId }) => itemId !== id);\n};\n\nexport { getPageName, createNewListItem, updateListItems, deleteFromListItems };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAoD;AAAA;AAEpD,IAAMA,WAAW,GAAG,SAAdA,WAAW,GAA4C;EAAA,IAAxCC,iBAAiB,uEAAG,CAAC,CAAC;EAAA,IAAEC,MAAM,uEAAG,CAAC,CAAC;EACtD,IAAI,CAACD,iBAAiB,IAAI,CAACA,iBAAiB,CAACE,WAAW,EAAE;IACxD,IAAQC,IAAI,GAAkBF,MAAM,CAA5BE,IAAI;MAAMC,OAAO,GAAKH,MAAM,CAAtBI,EAAE;IAChB,OAAOF,IAAI,IAAIC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BAAmB,GAAG,SAAtBA,mBAAmB,QAA4B;EAAA,IAAtBV,WAAW,SAAXA,WAAW;IAAER,EAAE,SAAFA,EAAE;EAC5C,IAAI,CAACQ,WAAW,IAAI,CAACR,EAAE,EAAE,MAAM,IAAIW,sBAAU,CAAC,uCAAuC,CAAC;EACtF,OAAOH,WAAW,CAACW,MAAM,CAAC;IAAA,IAAOC,MAAM,SAAVpB,EAAE;IAAA,OAAeoB,MAAM,KAAKpB,EAAE;EAAA,EAAC;AAC9D,CAAC;AAAC"}
1
+ {"version":3,"file":"data-mappers.js","names":["getPageName","displayProperties","entity","adminHeader","name","fieldId","id","reduce","acc","headerProperty","item","push","join","createNewListItem","listingData","result","updateListItems","BlazeError","map","mapperResult","Object","keys","forEach","key","deleteFromListItems","filter","itemId"],"sources":["../../../../src/components/EntityManager/utils/data-mappers.js"],"sourcesContent":["import { BlazeError } from '@blaze-cms/core-errors';\n\nconst getPageName = (displayProperties = {}, entity = {}) => {\n if (!displayProperties || !displayProperties.adminHeader) {\n const { name, id: fieldId } = entity;\n return name || fieldId || '';\n }\n\n const { adminHeader } = displayProperties;\n return adminHeader\n .reduce((acc, headerProperty) => {\n const item = entity[headerProperty];\n if (item) acc.push(item);\n return acc;\n }, [])\n .join(' ');\n};\n\nconst createNewListItem = ({ listingData, result }) => [...listingData, result];\n\nconst updateListItems = ({ listingData, result, id } = {}) => {\n if (!listingData || !result || !id)\n throw new BlazeError('Expected object with: listingData, result, id');\n return listingData.map(item => {\n const mapperResult = { ...item };\n if (item.id === id) {\n Object.keys(item).forEach(key => {\n if (result[key] && key !== 'id') {\n mapperResult[key] = result[key];\n }\n });\n return mapperResult;\n }\n return mapperResult;\n });\n};\n\nconst deleteFromListItems = ({ listingData, id } = {}) => {\n if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');\n return listingData.filter(({ id: itemId }) => itemId !== id);\n};\n\nexport { getPageName, createNewListItem, updateListItems, deleteFromListItems };\n"],"mappings":";;;;;;;;;;;;;;;;;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KAAKA,EAAE,EAAE;MAClBc,MAAM,CAACC,IAAI,CAACX,IAAI,CAAC,CAACY,OAAO,CAAC,UAAAC,GAAG,EAAI;QAC/B,IAAIR,MAAM,CAACQ,GAAG,CAAC,IAAIA,GAAG,KAAK,IAAI,EAAE;UAC/BJ,YAAY,CAACI,GAAG,CAAC,GAAGR,MAAM,CAACQ,GAAG,CAAC;QACjC;MACF,CAAC,CAAC;MACF,OAAOJ,YAAY;IACrB;IACA,OAAOA,YAAY;EACrB,CAAC,CAAC;AACJ,CAAC;AAAC;AAEF,IAAMK,mBAAmB,GAAG,SAAtBA,mBAAmB,GAAiC;EAAA,gFAAP,CAAC,CAAC;IAAtBV,WAAW,SAAXA,WAAW;IAAER,EAAE,SAAFA,EAAE;EAC5C,IAAI,CAACQ,WAAW,IAAI,CAACR,EAAE,EAAE,MAAM,IAAIW,sBAAU,CAAC,uCAAuC,CAAC;EACtF,OAAOH,WAAW,CAACW,MAAM,CAAC;IAAA,IAAOC,MAAM,SAAVpB,EAAE;IAAA,OAAeoB,MAAM,KAAKpB,EAAE;EAAA,EAAC;AAC9D,CAAC;AAAC"}
@@ -16,7 +16,7 @@ function buildListingQuery(entitySchema) {
16
16
  throw new _coreErrors.BlazeError('Listing query requires getAll action and listingProperties from entity schema');
17
17
  }
18
18
  var sortType = entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
19
- return (0, _client.gql)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n query ", "($limit: Int, $offset:Int, $sort: [", "SortItem]) {\n listingData: ", "(limit: $limit, offset:$offset, sort:$sort){\n id,\n ", "\n }\n }\n "])), entitySchema.actions.getAll, sortType, entitySchema.actions.getAll, entitySchema.listingProperties.join(',\n'));
19
+ return (0, _client.gql)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n query ", "($where: JSON, $limit: Int, $offset:Int, $sort: [", "SortItem]) {\n listingData: ", "(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ", "\n }\n }\n "])), entitySchema.actions.getAll, sortType, entitySchema.actions.getAll, entitySchema.listingProperties.join(',\n'));
20
20
  }
21
21
  var _default = buildListingQuery;
22
22
  exports["default"] = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"build-listing-query.js","names":["buildListingQuery","entitySchema","actions","getAll","listingProperties","BlazeError","sortType","toUpperCase","substr","gql","join"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildListingQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${entitySchema.actions.getAll}($limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${entitySchema.actions.getAll}(limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":";;;;;;;;;;AAAA;AACA;AAAoD;AAEpD,SAASA,iBAAiB,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,iBAAiB,EAAE;IAC5F,MAAM,IAAIC,sBAAU,CAClB,+EAA+E,CAChF;EACH;EAEA,IAAMC,QAAQ,GACZL,YAAY,CAACC,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACI,WAAW,EAAE,GAAGN,YAAY,CAACC,OAAO,CAACC,MAAM,CAACK,MAAM,CAAC,CAAC,CAAC;EAEtF,WAAOC,WAAG,+QACAR,YAAY,CAACC,OAAO,CAACC,MAAM,EAAsCG,QAAQ,EAChEL,YAAY,CAACC,OAAO,CAACC,MAAM,EAEtCF,YAAY,CAACG,iBAAiB,CAACM,IAAI,CAAC,KAAK,CAAC;AAIpD;AAAC,eAEcV,iBAAiB;AAAA"}
1
+ {"version":3,"file":"build-listing-query.js","names":["buildListingQuery","entitySchema","actions","getAll","listingProperties","BlazeError","sortType","toUpperCase","substr","gql","join"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildListingQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${\n entitySchema.actions.getAll\n }($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${\n entitySchema.actions.getAll\n }(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":";;;;;;;;;;AAAA;AACA;AAAoD;AAEpD,SAASA,iBAAiB,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,iBAAiB,EAAE;IAC5F,MAAM,IAAIC,sBAAU,CAClB,+EAA+E,CAChF;EACH;EAEA,IAAMC,QAAQ,GACZL,YAAY,CAACC,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACI,WAAW,EAAE,GAAGN,YAAY,CAACC,OAAO,CAACC,MAAM,CAACK,MAAM,CAAC,CAAC,CAAC;EAEtF,WAAOC,WAAG,4SAENR,YAAY,CAACC,OAAO,CAACC,MAAM,EACuBG,QAAQ,EAExDL,YAAY,CAACC,OAAO,CAACC,MAAM,EAGzBF,YAAY,CAACG,iBAAiB,CAACM,IAAI,CAAC,KAAK,CAAC;AAIpD;AAAC,eAEcV,iBAAiB;AAAA"}
@@ -8,7 +8,10 @@ exports.getDefaultQueryParams = void 0;
8
8
  var getDefaultQueryParams = function getDefaultQueryParams(_ref) {
9
9
  var schema = _ref.schema;
10
10
  var updated = schema.properties && schema.properties.updated;
11
+ var _ref2 = schema.displayProperties || {},
12
+ where = _ref2.adminDefaultListingFilter;
11
13
  return {
14
+ where: where,
12
15
  limit: 40,
13
16
  offset: 0,
14
17
  sort: updated ? [{
@@ -1 +1 @@
1
- {"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","limit","offset","sort","property","direction"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = ({ schema }) => {\n const updated = schema.properties && schema.properties.updated;\n\n return {\n limit: 40,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":";;;;;;;AAAA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqB,OAAmB;EAAA,IAAbC,MAAM,QAANA,MAAM;EACrC,IAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAE9D,OAAO;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAEJ,OAAO,GACT,CACE;MACEK,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF,GACD;EACN,CAAC;AACH,CAAC;AAAC"}
1
+ {"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","displayProperties","where","adminDefaultListingFilter","limit","offset","sort","property","direction"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = ({ schema }) => {\n const updated = schema.properties && schema.properties.updated;\n const { adminDefaultListingFilter: where } = schema.displayProperties || {};\n\n return {\n where,\n limit: 40,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":";;;;;;;AAAA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqB,OAAmB;EAAA,IAAbC,MAAM,QAANA,MAAM;EACrC,IAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAC9D,YAA6CD,MAAM,CAACG,iBAAiB,IAAI,CAAC,CAAC;IAAxCC,KAAK,SAAhCC,yBAAyB;EAEjC,OAAO;IACLD,KAAK,EAALA,KAAK;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAEP,OAAO,GACT,CACE;MACEQ,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF,GACD;EACN,CAAC;AACH,CAAC;AAAC"}
@@ -27,7 +27,7 @@ const updateListItems = ({
27
27
  listingData,
28
28
  result,
29
29
  id
30
- }) => {
30
+ } = {}) => {
31
31
  if (!listingData || !result || !id) throw new BlazeError('Expected object with: listingData, result, id');
32
32
  return listingData.map(item => {
33
33
  const mapperResult = _objectSpread({}, item);
@@ -45,7 +45,7 @@ const updateListItems = ({
45
45
  const deleteFromListItems = ({
46
46
  listingData,
47
47
  id
48
- }) => {
48
+ } = {}) => {
49
49
  if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');
50
50
  return listingData.filter(({
51
51
  id: itemId
@@ -1 +1 @@
1
- {"version":3,"file":"data-mappers.js","names":["BlazeError","getPageName","displayProperties","entity","adminHeader","name","id","fieldId","reduce","acc","headerProperty","item","push","join","createNewListItem","listingData","result","updateListItems","map","mapperResult","Object","keys","forEach","key","deleteFromListItems","filter","itemId"],"sources":["../../../../src/components/EntityManager/utils/data-mappers.js"],"sourcesContent":["import { BlazeError } from '@blaze-cms/core-errors';\n\nconst getPageName = (displayProperties = {}, entity = {}) => {\n if (!displayProperties || !displayProperties.adminHeader) {\n const { name, id: fieldId } = entity;\n return name || fieldId || '';\n }\n\n const { adminHeader } = displayProperties;\n return adminHeader\n .reduce((acc, headerProperty) => {\n const item = entity[headerProperty];\n if (item) acc.push(item);\n return acc;\n }, [])\n .join(' ');\n};\n\nconst createNewListItem = ({ listingData, result }) => [...listingData, result];\n\nconst updateListItems = ({ listingData, result, id }) => {\n if (!listingData || !result || !id)\n throw new BlazeError('Expected object with: listingData, result, id');\n return listingData.map(item => {\n const mapperResult = { ...item };\n if (item.id === id) {\n Object.keys(item).forEach(key => {\n if (result[key] && key !== 'id') {\n mapperResult[key] = result[key];\n }\n });\n return mapperResult;\n }\n return mapperResult;\n });\n};\n\nconst deleteFromListItems = ({ listingData, id }) => {\n if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');\n return listingData.filter(({ id: itemId }) => itemId !== id);\n};\n\nexport { getPageName, createNewListItem, updateListItems, deleteFromListItems };\n"],"mappings":";;;AAAA,SAASA,UAAU,QAAQ,wBAAwB;AAEnD,MAAMC,WAAW,GAAG,CAACC,iBAAiB,GAAG,CAAC,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,KAAK;EAC3D,IAAI,CAACD,iBAAiB,IAAI,CAACA,iBAAiB,CAACE,WAAW,EAAE;IACxD,MAAM;MAAEC,IAAI;MAAEC,EAAE,EAAEC;IAAQ,CAAC,GAAGJ,MAAM;IACpC,OAAOE,IAAI,IAAIE,OAAO,IAAI,EAAE;EAC9B;EAEA,MAAM;IAAEH;EAAY,CAAC,GAAGF,iBAAiB;EACzC,OAAOE,WAAW,CACfI,MAAM,CAAC,CAACC,GAAG,EAAEC,cAAc,KAAK;IAC/B,MAAMC,IAAI,GAAGR,MAAM,CAACO,cAAc,CAAC;IACnC,IAAIC,IAAI,EAAEF,GAAG,CAACG,IAAI,CAACD,IAAI,CAAC;IACxB,OAAOF,GAAG;EACZ,CAAC,EAAE,EAAE,CAAC,CACLI,IAAI,CAAC,GAAG,CAAC;AACd,CAAC;AAED,MAAMC,iBAAiB,GAAG,CAAC;EAAEC,WAAW;EAAEC;AAAO,CAAC,KAAK,CAAC,GAAGD,WAAW,EAAEC,MAAM,CAAC;AAE/E,MAAMC,eAAe,GAAG,CAAC;EAAEF,WAAW;EAAEC,MAAM;EAAEV;AAAG,CAAC,KAAK;EACvD,IAAI,CAACS,WAAW,IAAI,CAACC,MAAM,IAAI,CAACV,EAAE,EAChC,MAAM,IAAIN,UAAU,CAAC,+CAA+C,CAAC;EACvE,OAAOe,WAAW,CAACG,GAAG,CAACP,IAAI,IAAI;IAC7B,MAAMQ,YAAY,qBAAQR,IAAI,CAAE;IAChC,IAAIA,IAAI,CAACL,EAAE,KAAKA,EAAE,EAAE;MAClBc,MAAM,CAACC,IAAI,CAACV,IAAI,CAAC,CAACW,OAAO,CAACC,GAAG,IAAI;QAC/B,IAAIP,MAAM,CAACO,GAAG,CAAC,IAAIA,GAAG,KAAK,IAAI,EAAE;UAC/BJ,YAAY,CAACI,GAAG,CAAC,GAAGP,MAAM,CAACO,GAAG,CAAC;QACjC;MACF,CAAC,CAAC;MACF,OAAOJ,YAAY;IACrB;IACA,OAAOA,YAAY;EACrB,CAAC,CAAC;AACJ,CAAC;AAED,MAAMK,mBAAmB,GAAG,CAAC;EAAET,WAAW;EAAET;AAAG,CAAC,KAAK;EACnD,IAAI,CAACS,WAAW,IAAI,CAACT,EAAE,EAAE,MAAM,IAAIN,UAAU,CAAC,uCAAuC,CAAC;EACtF,OAAOe,WAAW,CAACU,MAAM,CAAC,CAAC;IAAEnB,EAAE,EAAEoB;EAAO,CAAC,KAAKA,MAAM,KAAKpB,EAAE,CAAC;AAC9D,CAAC;AAED,SAASL,WAAW,EAAEa,iBAAiB,EAAEG,eAAe,EAAEO,mBAAmB"}
1
+ {"version":3,"file":"data-mappers.js","names":["BlazeError","getPageName","displayProperties","entity","adminHeader","name","id","fieldId","reduce","acc","headerProperty","item","push","join","createNewListItem","listingData","result","updateListItems","map","mapperResult","Object","keys","forEach","key","deleteFromListItems","filter","itemId"],"sources":["../../../../src/components/EntityManager/utils/data-mappers.js"],"sourcesContent":["import { BlazeError } from '@blaze-cms/core-errors';\n\nconst getPageName = (displayProperties = {}, entity = {}) => {\n if (!displayProperties || !displayProperties.adminHeader) {\n const { name, id: fieldId } = entity;\n return name || fieldId || '';\n }\n\n const { adminHeader } = displayProperties;\n return adminHeader\n .reduce((acc, headerProperty) => {\n const item = entity[headerProperty];\n if (item) acc.push(item);\n return acc;\n }, [])\n .join(' ');\n};\n\nconst createNewListItem = ({ listingData, result }) => [...listingData, result];\n\nconst updateListItems = ({ listingData, result, id } = {}) => {\n if (!listingData || !result || !id)\n throw new BlazeError('Expected object with: listingData, result, id');\n return listingData.map(item => {\n const mapperResult = { ...item };\n if (item.id === id) {\n Object.keys(item).forEach(key => {\n if (result[key] && key !== 'id') {\n mapperResult[key] = result[key];\n }\n });\n return mapperResult;\n }\n return mapperResult;\n });\n};\n\nconst deleteFromListItems = ({ listingData, id } = {}) => {\n if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');\n return listingData.filter(({ id: itemId }) => itemId !== id);\n};\n\nexport { getPageName, createNewListItem, updateListItems, deleteFromListItems };\n"],"mappings":";;;AAAA,SAASA,UAAU,QAAQ,wBAAwB;AAEnD,MAAMC,WAAW,GAAG,CAACC,iBAAiB,GAAG,CAAC,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,KAAK;EAC3D,IAAI,CAACD,iBAAiB,IAAI,CAACA,iBAAiB,CAACE,WAAW,EAAE;IACxD,MAAM;MAAEC,IAAI;MAAEC,EAAE,EAAEC;IAAQ,CAAC,GAAGJ,MAAM;IACpC,OAAOE,IAAI,IAAIE,OAAO,IAAI,EAAE;EAC9B;EAEA,MAAM;IAAEH;EAAY,CAAC,GAAGF,iBAAiB;EACzC,OAAOE,WAAW,CACfI,MAAM,CAAC,CAACC,GAAG,EAAEC,cAAc,KAAK;IAC/B,MAAMC,IAAI,GAAGR,MAAM,CAACO,c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,SAASL,WAAW,EAAEa,iBAAiB,EAAEG,eAAe,EAAEO,mBAAmB"}
@@ -6,8 +6,8 @@ function buildListingQuery(entitySchema) {
6
6
  }
7
7
  const sortType = entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
8
8
  return gql`
9
- query ${entitySchema.actions.getAll}($limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {
10
- listingData: ${entitySchema.actions.getAll}(limit: $limit, offset:$offset, sort:$sort){
9
+ query ${entitySchema.actions.getAll}($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {
10
+ listingData: ${entitySchema.actions.getAll}(where: $where, limit: $limit, offset:$offset, sort:$sort){
11
11
  id,
12
12
  ${entitySchema.listingProperties.join(',\n')}
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","buildListingQuery","entitySchema","actions","getAll","listingProperties","sortType","toUpperCase","substr","join"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildListingQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${entitySchema.actions.getAll}($limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${entitySchema.actions.getAll}(limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,iBAAiB,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,iBAAiB,EAAE;IAC5F,MAAM,IAAIL,UAAU,CAClB,+EAA+E,CAChF;EACH;EAEA,MAAMM,QAAQ,GACZJ,YAAY,CAACC,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACG,WAAW,EAAE,GAAGL,YAAY,CAACC,OAAO,CAACC,MAAM,CAACI,MAAM,CAAC,CAAC,CAAC;EAEtF,OAAOT,GAAI;AACb,YAAYG,YAAY,CAACC,OAAO,CAACC,MAAO,sCAAqCE,QAAS;AACtF,qBAAqBJ,YAAY,CAACC,OAAO,CAACC,MAAO;AACjD;AACA,UAAUF,YAAY,CAACG,iBAAiB,CAACI,IAAI,CAAC,KAAK,CAAE;AACrD;AACA;AACA,GAAG;AACH;AAEA,eAAeR,iBAAiB"}
1
+ {"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","buildListingQuery","entitySchema","actions","getAll","listingProperties","sortType","toUpperCase","substr","join"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildListingQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${\n entitySchema.actions.getAll\n }($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${\n entitySchema.actions.getAll\n }(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,iBAAiB,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,iBAAiB,EAAE;IAC5F,MAAM,IAAIL,UAAU,CAClB,+EAA+E,CAChF;EACH;EAEA,MAAMM,QAAQ,GACZJ,YAAY,CAACC,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACG,WAAW,EAAE,GAAGL,YAAY,CAACC,OAAO,CAACC,MAAM,CAACI,MAAM,CAAC,CAAC,CAAC;EAEtF,OAAOT,GAAI;AACb,YACMG,YAAY,CAACC,OAAO,CAACC,MACtB,oDAAmDE,QAAS;AACjE,qBACQJ,YAAY,CAACC,OAAO,CAACC,MACtB;AACP;AACA,UAAUF,YAAY,CAACG,iBAAiB,CAACI,IAAI,CAAC,KAAK,CAAE;AACrD;AACA;AACA,GAAG;AACH;AAEA,eAAeR,iBAAiB"}
@@ -2,7 +2,11 @@ const getDefaultQueryParams = ({
2
2
  schema
3
3
  }) => {
4
4
  const updated = schema.properties && schema.properties.updated;
5
+ const {
6
+ adminDefaultListingFilter: where
7
+ } = schema.displayProperties || {};
5
8
  return {
9
+ where,
6
10
  limit: 40,
7
11
  offset: 0,
8
12
  sort: updated ? [{
@@ -1 +1 @@
1
- {"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","limit","offset","sort","property","direction"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = ({ schema }) => {\n const updated = schema.properties && schema.properties.updated;\n\n return {\n limit: 40,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAAO,CAAC,KAAK;EAC5C,MAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAE9D,OAAO;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAEJ,OAAO,GACT,CACE;MACEK,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF,GACD;EACN,CAAC;AACH,CAAC;AAED,SAASR,qBAAqB"}
1
+ {"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","adminDefaultListingFilter","where","displayProperties","limit","offset","sort","property","direction"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = ({ schema }) => {\n const updated = schema.properties && schema.properties.updated;\n const { adminDefaultListingFilter: where } = schema.displayProperties || {};\n\n return {\n where,\n limit: 40,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAAO,CAAC,KAAK;EAC5C,MAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAC9D,MAAM;IAAEE,yBAAyB,EAAEC;EAAM,CAAC,GAAGJ,MAAM,CAACK,iBAAiB,IAAI,CAAC,CAAC;EAE3E,OAAO;IACLD,KAAK;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAEP,OAAO,GACT,CACE;MACEQ,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF,GACD;EACN,CAAC;AACH,CAAC;AAED,SAASX,qBAAqB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaze-cms/plugin-data-ui",
3
- "version": "0.125.0-f-admin-updates.5",
3
+ "version": "0.126.0-admin-updates.0",
4
4
  "description": "Blaze plugin data ui",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "license": "GPL-3.0",
29
29
  "dependencies": {
30
- "@blaze-cms/admin-ui-utils": "0.125.0-f-admin-updates.5",
30
+ "@blaze-cms/admin-ui-utils": "0.126.0-admin-updates.0",
31
31
  "@blaze-cms/core-errors": "^0.118.0",
32
- "@blaze-cms/react-form-builder": "0.125.0-f-admin-updates.5",
33
- "@blaze-cms/react-page-builder": "0.125.0-f-admin-updates.5",
32
+ "@blaze-cms/react-form-builder": "0.126.0-admin-updates.0",
33
+ "@blaze-cms/react-page-builder": "0.126.0-admin-updates.0",
34
34
  "@blaze-cms/setup-ui": "^0.92.0",
35
- "@blaze-cms/versioning-ui": "^0.125.0-f-admin-updates.0",
35
+ "@blaze-cms/versioning-ui": "0.126.0-admin-updates.0",
36
36
  "@blaze-react/button": "0.5.19",
37
37
  "@blaze-react/more": "0.5.19",
38
38
  "@blaze-react/multiselect": "0.6.6",
@@ -53,7 +53,7 @@
53
53
  "uuid": "^3.3.3"
54
54
  },
55
55
  "devDependencies": {
56
- "@blaze-cms/core-ui": "^0.121.0"
56
+ "@blaze-cms/core-ui": "0.126.0-admin-updates.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@apollo/client": "3.x",
@@ -65,5 +65,5 @@
65
65
  "lib/*",
66
66
  "lib-es/*"
67
67
  ],
68
- "gitHead": "62834d797f1702a0179c491c5edce0b4d352ffe3"
68
+ "gitHead": "367c26e37b192fa22e3917b79ac5b3b5ec3d4ed8"
69
69
  }
@@ -18,7 +18,7 @@ const getPageName = (displayProperties = {}, entity = {}) => {
18
18
 
19
19
  const createNewListItem = ({ listingData, result }) => [...listingData, result];
20
20
 
21
- const updateListItems = ({ listingData, result, id }) => {
21
+ const updateListItems = ({ listingData, result, id } = {}) => {
22
22
  if (!listingData || !result || !id)
23
23
  throw new BlazeError('Expected object with: listingData, result, id');
24
24
  return listingData.map(item => {
@@ -35,7 +35,7 @@ const updateListItems = ({ listingData, result, id }) => {
35
35
  });
36
36
  };
37
37
 
38
- const deleteFromListItems = ({ listingData, id }) => {
38
+ const deleteFromListItems = ({ listingData, id } = {}) => {
39
39
  if (!listingData || !id) throw new BlazeError('Expected object with: listingData, id');
40
40
  return listingData.filter(({ id: itemId }) => itemId !== id);
41
41
  };
@@ -12,8 +12,12 @@ function buildListingQuery(entitySchema) {
12
12
  entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);
13
13
 
14
14
  return gql`
15
- query ${entitySchema.actions.getAll}($limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {
16
- listingData: ${entitySchema.actions.getAll}(limit: $limit, offset:$offset, sort:$sort){
15
+ query ${
16
+ entitySchema.actions.getAll
17
+ }($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {
18
+ listingData: ${
19
+ entitySchema.actions.getAll
20
+ }(where: $where, limit: $limit, offset:$offset, sort:$sort){
17
21
  id,
18
22
  ${entitySchema.listingProperties.join(',\n')}
19
23
  }
@@ -1,7 +1,9 @@
1
1
  const getDefaultQueryParams = ({ schema }) => {
2
2
  const updated = schema.properties && schema.properties.updated;
3
+ const { adminDefaultListingFilter: where } = schema.displayProperties || {};
3
4
 
4
5
  return {
6
+ where,
5
7
  limit: 40,
6
8
  offset: 0,
7
9
  sort: updated