Compare commits

..

9 Commits

Author SHA1 Message Date
Daniel Schlachter
7e1b33d423 Merge branch 'main' into uom 2025-05-28 11:28:44 +02:00
Johannes Vogel
6fa2aaee34 fiori: rm unused hierarchy elements (#838) 2025-05-15 15:43:21 +02:00
Daniel Hutzel
ccb61c9b69 feat: add associations for PackagingUnit, Length, and Weight types 2025-05-14 14:13:24 +02:00
Daniel Hutzel
169fda660b feat: add UOM module import to common index 2025-05-14 14:12:19 +02:00
Daniel Hutzel
f3209da2e1 Adding samples for Units of Measures 2025-05-14 14:09:51 +02:00
Daniel Hutzel
987611b009 cosmetics 2025-05-14 14:09:13 +02:00
Daniel Hutzel
ce1da7fce9 cleanup deps in nested tests' package.jsons 2025-05-08 10:28:48 +02:00
Daniel Hutzel
395587b1bf fix: update SAP UI5 resource URLs to use the latest domain 2025-05-07 10:29:17 +02:00
Johannes Vogel
bab7827000 chore(deps): allow newer cap-js versions (#835) 2025-04-29 14:48:22 +02:00
16 changed files with 87 additions and 66 deletions

View File

@@ -9,7 +9,7 @@
"index.cds" "index.cds"
], ],
"devDependencies": { "devDependencies": {
"@cap-js/sqlite": "*" "@cap-js/sqlite": ">=1"
}, },
"dependencies": { "dependencies": {
"@sap/cds": ">=7", "@sap/cds": ">=7",

View File

@@ -11,7 +11,7 @@
"@sap-cloud-sdk/resilience": "^4", "@sap-cloud-sdk/resilience": "^4",
"@sap/cds": ">=5", "@sap/cds": ">=5",
"express": "^4.17.1", "express": "^4.17.1",
"@cap-js/hana": "^1" "@cap-js/hana": ">=1"
}, },
"cds": { "cds": {
"requires": { "requires": {

13
common/currencies.cds Normal file
View File

@@ -0,0 +1,13 @@
using { sap } from '@sap/cds/common';
extend sap.common.Currencies with {
// Currencies.code = ISO 4217 alphabetic three-letter code
// with the first two letters being equal to ISO 3166 alphabetic country codes
// See also:
// [1] https://www.iso.org/iso-4217-currency-codes.html
// [2] https://www.currency-iso.org/en/home/tables/table-a1.html
// [3] https://www.ibm.com/support/knowledgecenter/en/SSZLC2_7.0.0/com.ibm.commerce.payments.developer.doc/refs/rpylerl2mst97.htm
numcode : Integer;
exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent
minor : String; //> e.g. 'Cent'
}

View File

@@ -0,0 +1,6 @@
code;name
g;Grams
kg;Kilograms
mg;Milligrams
lb;Pounds
oz;Ounces
1 code name
2 g Grams
3 kg Kilograms
4 mg Milligrams
5 lb Pounds
6 oz Ounces

View File

@@ -0,0 +1,11 @@
code;locale;name
g;de;Gramm
kg;de;Kilogramm
mg;de;Milligramm
lb;de;Pfund
oz;de;Unze
g;fr;Grammes
kg;fr;Kilogrammes
mg;fr;Milligrammes
lb;fr;Livres
oz;fr;Onces
1 code locale name
2 g de Gramm
3 kg de Kilogramm
4 mg de Milligramm
5 lb de Pfund
6 oz de Unze
7 g fr Grammes
8 kg fr Kilogrammes
9 mg fr Milligrammes
10 lb fr Livres
11 oz fr Onces

View File

@@ -1,45 +1,3 @@
using { sap } from '@sap/cds/common'; using from './currencies';
using from './regions';
extend sap.common.Currencies with { using from './uom';
// Currencies.code = ISO 4217 alphabetic three-letter code
// with the first two letters being equal to ISO 3166 alphabetic country codes
// See also:
// [1] https://www.iso.org/iso-4217-currency-codes.html
// [2] https://www.currency-iso.org/en/home/tables/table-a1.html
// [3] https://www.ibm.com/support/knowledgecenter/en/SSZLC2_7.0.0/com.ibm.commerce.payments.developer.doc/refs/rpylerl2mst97.htm
numcode : Integer;
exponent : Integer; //> e.g. 2 --> 1 Dollar = 10^2 Cent
minor : String; //> e.g. 'Cent'
}
/**
* The Code Lists below are designed as optional extensions to
* the base schema. Switch them on by adding an Association to
* one of the code list entities in your models or by:
* annotate sap.common.Countries with @cds.persistence.skip:false;
*/
context sap.common.countries {
extend sap.common.Countries {
regions : Composition of many Regions on regions._parent = $self.code;
}
entity Regions : sap.common.CodeList {
key code : String(5); // ISO 3166-2 alpha5 codes, e.g. DE-BW
children : Composition of many Regions on children._parent = $self.code;
cities : Composition of many Cities on cities.region = $self;
_parent : String(11);
}
entity Cities : sap.common.CodeList {
key code : String(11);
region : Association to Regions;
districts : Composition of many Districts on districts.city = $self;
}
entity Districts : sap.common.CodeList {
key code : String(11);
city : Association to Cities;
}
}

22
common/regions.cds Normal file
View File

@@ -0,0 +1,22 @@
using { sap.common } from '@sap/cds/common';
namespace sap.common.countries;
extend common.Countries {
regions : Composition of many Regions on regions._parent = $self.code;
}
entity Regions : common.CodeList {
key code : String(5); // ISO 3166-2 alpha5 codes, e.g. DE-BW
children : Composition of many Regions on children._parent = $self.code;
cities : Composition of many Cities on cities.region = $self;
_parent : String(11);
}
entity Cities : common.CodeList {
key code : String(11);
region : Association to Regions;
districts : Composition of many Districts on districts.city = $self;
}
entity Districts : common.CodeList {
key code : String(11);
city : Association to Cities;
}

19
common/uom.cds Normal file
View File

@@ -0,0 +1,19 @@
using { sap.common.CodeList } from '@sap/cds/common';
namespace sap.common.uom;
entity PackagingUnits : CodeList {
key code : String(3); // e.g. pc for Piece(s)
abbrev : localized String(3); // e.g. st for Stück
}
entity Weights : CodeList {
key code : String(3); // e.g. kg for Kilogram(s)
}
entity Lengths : CodeList {
key code : String(3); // e.g. m for Meter(s)
}
type PackagingUnit : Association to PackagingUnits;
type Length : Association to Lengths;
type Weight : Association to Weights;

View File

@@ -106,7 +106,7 @@
"name": "sap.fe.templates.ObjectPage", "name": "sap.fe.templates.ObjectPage",
"options": { "options": {
"settings" : { "settings" : {
"contextPath" : "/Books", "entitySet" : "Books",
"navigation" : { "navigation" : {
"Authors" : { "Authors" : {
"detail" : { "detail" : {
@@ -123,7 +123,7 @@
"name": "sap.fe.templates.ObjectPage", "name": "sap.fe.templates.ObjectPage",
"options": { "options": {
"settings" : { "settings" : {
"contextPath" : "/Authors" "entitySet" : "Authors"
} }
} }
} }
@@ -142,4 +142,4 @@
"registrationIds": [], "registrationIds": [],
"archeType": "transactional" "archeType": "transactional"
} }
} }

View File

@@ -99,7 +99,7 @@
"name": "sap.fe.templates.ListReport", "name": "sap.fe.templates.ListReport",
"options": { "options": {
"settings": { "settings": {
"contextPath": "/Books", "entitySet": "Books",
"initialLoad": true, "initialLoad": true,
"navigation": { "navigation": {
"Books": { "Books": {
@@ -117,7 +117,7 @@
"name": "sap.fe.templates.ObjectPage", "name": "sap.fe.templates.ObjectPage",
"options": { "options": {
"settings": { "settings": {
"contextPath": "/Books" "entitySet": "Books"
} }
} }
} }

View File

@@ -79,8 +79,6 @@ aspect Hierarchy {
LimitedDescendantCount : Integer64 = null; LimitedDescendantCount : Integer64 = null;
DistanceFromRoot : Integer64 = null; DistanceFromRoot : Integer64 = null;
DrillState : String = null; DrillState : String = null;
Matched : Boolean = null;
MatchedDescendantCount : Integer64 = null;
LimitedRank : Integer64 = null; LimitedRank : Integer64 = null;
} }
@@ -88,8 +86,6 @@ annotate Hierarchy with @Capabilities.FilterRestrictions.NonFilterableProperties
'LimitedDescendantCount', 'LimitedDescendantCount',
'DistanceFromRoot', 'DistanceFromRoot',
'DrillState', 'DrillState',
'Matched',
'MatchedDescendantCount',
'LimitedRank' 'LimitedRank'
]; ];
@@ -97,8 +93,6 @@ annotate Hierarchy with @Capabilities.SortRestrictions.NonSortableProperties: [
'LimitedDescendantCount', 'LimitedDescendantCount',
'DistanceFromRoot', 'DistanceFromRoot',
'DrillState', 'DrillState',
'Matched',
'MatchedDescendantCount',
'LimitedRank' 'LimitedRank'
]; ];
@@ -121,8 +115,6 @@ annotate my.Genres with @Hierarchy.RecursiveHierarchy #GenreHierarchy: {
LimitedDescendantCount: LimitedDescendantCount, LimitedDescendantCount: LimitedDescendantCount,
DistanceFromRoot : DistanceFromRoot, DistanceFromRoot : DistanceFromRoot,
DrillState : DrillState, DrillState : DrillState,
Matched : Matched,
MatchedDescendantCount: MatchedDescendantCount,
LimitedRank : LimitedRank LimitedRank : LimitedRank
}; };

View File

@@ -7,7 +7,7 @@
"express": "^4.17.1" "express": "^4.17.1"
}, },
"devDependencies": { "devDependencies": {
"@cap-js/sqlite": "^1" "@cap-js/sqlite": ">=1"
}, },
"scripts": { "scripts": {
"start": "cds-serve", "start": "cds-serve",

View File

@@ -23,8 +23,8 @@
}; };
</script> </script>
<script id="sap-ushell-bootstrap" src="https://sapui5.hana.ondemand.com/test-resources/sap/ushell/bootstrap/sandbox.js"></script> <script id="sap-ushell-bootstrap" src="https://ui5.sap.com/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
<script id="sap-ui-bootstrap" src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js" <script id="sap-ui-bootstrap" src="https://ui5.sap.com/resources/sap-ui-core.js"
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout" data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration, sap.ui.layout"
data-sap-ui-compatVersion="edge" data-sap-ui-compatVersion="edge"
data-sap-ui-theme="sap_horizon" data-sap-ui-theme="sap_horizon"

View File

@@ -2,7 +2,7 @@
"name": "@capire/orders", "name": "@capire/orders",
"version": "1.0.0", "version": "1.0.0",
"dependencies": { "dependencies": {
"@cap-js/hana": "^1", "@cap-js/hana": ">=1",
"@capire/common": "*", "@capire/common": "*",
"@sap/cds": ">=5", "@sap/cds": ">=5",
"@sap/xssec": "^4" "@sap/xssec": "^4"

View File

@@ -7,7 +7,7 @@
"index.cds" "index.cds"
], ],
"dependencies": { "dependencies": {
"@cap-js/hana": "^1", "@cap-js/hana": ">=1",
"@sap/cds": ">=5", "@sap/cds": ">=5",
"@sap/xssec": "^4.2.7", "@sap/xssec": "^4.2.7",
"express": "^4.17.1" "express": "^4.17.1"

View File

@@ -1,5 +1,5 @@
{ {
"devDependencies": { "devDependencies": {
"@cap-js/sqlite": "^1" "@cap-js/sqlite": "*"
} }
} }