@itrocks/framework 1.0.2 → 1.3.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/cjs/dependencies.js +3 -3
- package/cjs/property-select-actions.js +2 -2
- package/cjs/property-select-provider.js +8 -1
- package/cjs/property-select.d.ts +4 -0
- package/cjs/property-select.js +4 -2
- package/config.yaml +1 -0
- package/docs/property-select.md +6 -0
- package/fr-FR.csv +3 -0
- package/package.json +3 -1
package/cjs/dependencies.js
CHANGED
|
@@ -32,7 +32,7 @@ const store_1 = require("@itrocks/store");
|
|
|
32
32
|
const string_formats_1 = require("@itrocks/string-formats");
|
|
33
33
|
const transformers_3 = require("@itrocks/string-formats/transformers");
|
|
34
34
|
const template_1 = require("@itrocks/template");
|
|
35
|
-
const
|
|
35
|
+
const template_2 = require("@itrocks/template");
|
|
36
36
|
const transformer_1 = require("@itrocks/transformer");
|
|
37
37
|
const transformer_2 = require("@itrocks/transformer");
|
|
38
38
|
const transformer_3 = require("@itrocks/transformer");
|
|
@@ -86,7 +86,7 @@ function bind() {
|
|
|
86
86
|
setTransformers: core_transformers_2.initStoreTransformers,
|
|
87
87
|
toStoreName: rename_1.toColumn
|
|
88
88
|
});
|
|
89
|
-
(0,
|
|
89
|
+
(0, template_2.templateDependsOn)({
|
|
90
90
|
toString: async (data) => (((typeof data)[0] === 'o') && (data.toString === Object.prototype.toString))
|
|
91
91
|
? (await require('@itrocks/class-view').representativeValueOf(data))
|
|
92
92
|
: '' + data
|
|
@@ -95,7 +95,7 @@ function bind() {
|
|
|
95
95
|
action_1.Action.prototype.htmlTemplateResponse = async function (data, request, templateFile, statusCode = 200, headers = {}) {
|
|
96
96
|
const containerData = Object.assign(defaultContainerData(request), this);
|
|
97
97
|
const contained = !request.request.headers['xhr-info'] && config_1.config.container?.file;
|
|
98
|
-
const template = new
|
|
98
|
+
const template = new template_1.Template(data, containerData);
|
|
99
99
|
return this.htmlResponse(await template.parseFile(templateFile, contained && (0, node_path_1.join)(app_dir_1.appDir, config_1.config.container.file)), statusCode, headers);
|
|
100
100
|
};
|
|
101
101
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PropertySelectTemplate = exports.MetadataResolve = exports.MetadataContext = exports.MetadataConfiguration = void 0;
|
|
4
4
|
const action_1 = require("@itrocks/action");
|
|
5
|
-
const
|
|
5
|
+
const template_1 = require("@itrocks/template");
|
|
6
6
|
const property_select_1 = require("./property-select");
|
|
7
7
|
const property_select_2 = require("./property-select");
|
|
8
8
|
const property_select_provider_1 = require("./property-select-provider");
|
|
@@ -46,7 +46,7 @@ exports.MetadataResolve = MetadataResolve;
|
|
|
46
46
|
class PropertySelectTemplate extends action_1.Action {
|
|
47
47
|
async html() {
|
|
48
48
|
const template = require.resolve('@itrocks/property-select/front/property-select.html');
|
|
49
|
-
return this.htmlResponse(await
|
|
49
|
+
return this.htmlResponse(await new template_1.Template({}).parseFile(template));
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
exports.PropertySelectTemplate = PropertySelectTemplate;
|
|
@@ -5,6 +5,8 @@ const class_file_1 = require("@itrocks/class-file");
|
|
|
5
5
|
const class_type_1 = require("@itrocks/class-type");
|
|
6
6
|
const composition_1 = require("@itrocks/composition");
|
|
7
7
|
const composition_2 = require("@itrocks/composition");
|
|
8
|
+
const property_expand_1 = require("@itrocks/property-expand");
|
|
9
|
+
const property_group_1 = require("@itrocks/property-group");
|
|
8
10
|
const property_select_1 = require("@itrocks/property-select");
|
|
9
11
|
const route_1 = require("@itrocks/route");
|
|
10
12
|
const translate_1 = require("@itrocks/translate");
|
|
@@ -94,13 +96,18 @@ class ReflectionMetadataProvider {
|
|
|
94
96
|
}
|
|
95
97
|
aborted(signal);
|
|
96
98
|
const { displayOf: classDisplay } = require('@itrocks/class-view');
|
|
97
|
-
|
|
99
|
+
const groups = Object.entries((0, property_group_1.groupOf)(target)).map(([name, members]) => ({
|
|
100
|
+
label: (0, translate_1.tr)(name), name,
|
|
101
|
+
properties: properties.filter(property => members.includes(property.name)).map(property => property.path)
|
|
102
|
+
})).filter(group => group.properties.length);
|
|
103
|
+
return { groups, label: (0, translate_1.tr)(classDisplay(target) || target.name), path, properties, type: typeId(target) };
|
|
98
104
|
}
|
|
99
105
|
description(context, name, path, names) {
|
|
100
106
|
const { displayOf } = require('@itrocks/property-view');
|
|
101
107
|
const property = new reflect_property_1.ReflectProperty(context, name);
|
|
102
108
|
const fact = property.relation;
|
|
103
109
|
const description = {
|
|
110
|
+
component: !!(0, composition_1.componentOf)(context.type, name) || (0, property_expand_1.expandOf)(context.type, name),
|
|
104
111
|
kind: fact ? 'relation' : 'terminal', label: (0, translate_1.tr)(displayOf(context.type, name) || name),
|
|
105
112
|
name, order: names.indexOf(name), path
|
|
106
113
|
};
|
package/cjs/property-select.d.ts
CHANGED
|
@@ -28,6 +28,10 @@ export declare function metadataBootstrap(request: Request, root: RootId, usedPa
|
|
|
28
28
|
revision: number;
|
|
29
29
|
};
|
|
30
30
|
template: string;
|
|
31
|
+
translations: {
|
|
32
|
+
'Add columns': string;
|
|
33
|
+
Others: string;
|
|
34
|
+
};
|
|
31
35
|
advice: readonly string[];
|
|
32
36
|
version: string;
|
|
33
37
|
}>;
|
package/cjs/property-select.js
CHANGED
|
@@ -15,7 +15,8 @@ const selector_state_1 = require("@itrocks/list/selector-state");
|
|
|
15
15
|
const property_select_1 = require("@itrocks/property-select");
|
|
16
16
|
const property_select_2 = require("@itrocks/property-select");
|
|
17
17
|
const route_1 = require("@itrocks/route");
|
|
18
|
-
const
|
|
18
|
+
const template_1 = require("@itrocks/template");
|
|
19
|
+
const translate_1 = require("@itrocks/translate");
|
|
19
20
|
const property_select_provider_1 = require("./property-select-provider");
|
|
20
21
|
const property_select_provider_2 = require("./property-select-provider");
|
|
21
22
|
const dependencies = { advice: () => [], authorise: () => true };
|
|
@@ -96,7 +97,8 @@ async function metadataBootstrap(request, root, usedPaths, record) {
|
|
|
96
97
|
return {
|
|
97
98
|
...configuration, contexts: [...contexts.values()], errors: [...errors],
|
|
98
99
|
record: { ...record, state: selector.snapshot() },
|
|
99
|
-
template: await
|
|
100
|
+
template: await new template_1.Template({}).parseFile(require.resolve('@itrocks/property-select/front/property-select.html')),
|
|
101
|
+
translations: { 'Add columns': (0, translate_1.tr)('Add columns'), Others: (0, translate_1.tr)('Others') }
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
104
|
finally {
|
package/config.yaml
CHANGED
package/docs/property-select.md
CHANGED
|
@@ -48,6 +48,12 @@ constructing domain records. Metadata uses declared property types, never getter
|
|
|
48
48
|
|
|
49
49
|
`context(root, path, signal?)` returns one object's authorised properties, with full root-relative paths.
|
|
50
50
|
`resolve(root, '', signal?)` returns that root context; another path returns one property description.
|
|
51
|
+
Functional groups come from `groupOf(target)` in `@itrocks/property-group`. Each group contains its stable name,
|
|
52
|
+
translated label and authorised full property paths; empty groups are omitted. Inherited and property-level
|
|
53
|
+
`@Group` declarations use the same accessor.
|
|
54
|
+
Relations marked `@Component` or [`@Expand`](https://github.com/itrocks-ts/property-expand) receive `component: true`.
|
|
55
|
+
The selector presents both as identical groups of authorised child properties. `@Expand` only requests expansion;
|
|
56
|
+
it does not declare composition, change cardinality or infer an ownership inverse.
|
|
51
57
|
Labels and order reuse `class-view` and `property-view`, with technical-name fallbacks. Order gaps after permission
|
|
52
58
|
filtering retain the original business order. Host translation remains separate.
|
|
53
59
|
|
package/fr-FR.csv
CHANGED
|
@@ -10,6 +10,7 @@ $1 saved;$1 enregistré
|
|
|
10
10
|
an email for password reset was sent to you;un mail de réinitialisation de mot de passe vous a été envoyé
|
|
11
11
|
active;actif
|
|
12
12
|
add;ajouter
|
|
13
|
+
add columns;ajouter des colonnes
|
|
13
14
|
add $1;ajouter $1
|
|
14
15
|
age;age
|
|
15
16
|
all data will be lost;toutes les données seront perdues
|
|
@@ -17,6 +18,7 @@ authenticate user;authentifier l'utilisateur
|
|
|
17
18
|
back;retour
|
|
18
19
|
birthday;date de naissance
|
|
19
20
|
cancel;annuler
|
|
21
|
+
clear search;effacer la recherche
|
|
20
22
|
close;fermer
|
|
21
23
|
confirm;confirmer
|
|
22
24
|
continue;continuer
|
|
@@ -47,6 +49,7 @@ name;nom
|
|
|
47
49
|
new;nouveau
|
|
48
50
|
new $1;nouveau $1
|
|
49
51
|
no;non
|
|
52
|
+
others;autres
|
|
50
53
|
password;mot de passe
|
|
51
54
|
password reset request;demande de réinitialisation de mot de passe
|
|
52
55
|
please confirm;veuillez confirmer
|
package/package.json
CHANGED
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"@itrocks/mysql": "latest",
|
|
37
37
|
"@itrocks/notifications": "latest",
|
|
38
38
|
"@itrocks/password": "latest",
|
|
39
|
+
"@itrocks/property-expand": "latest",
|
|
40
|
+
"@itrocks/property-group": "latest",
|
|
39
41
|
"@itrocks/property-select": "latest",
|
|
40
42
|
"@itrocks/property-translate": "latest",
|
|
41
43
|
"@itrocks/property-type": "latest",
|
|
@@ -121,5 +123,5 @@
|
|
|
121
123
|
"build:test": "tsc -p test/tsconfig.json",
|
|
122
124
|
"test": "npm run build && npm run build:test && node --test test/*.test.js test/*.test.mjs"
|
|
123
125
|
},
|
|
124
|
-
"version": "1.0
|
|
126
|
+
"version": "1.3.0"
|
|
125
127
|
}
|