@phis/ui 0.7.4 → 0.7.7
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/components/controls/phi-form-control.d.ts +3 -1
- package/components/controls/phi-form-control.js +5 -4
- package/components/controls/phi-options-provider.d.ts +14 -1
- package/components/controls/phi-options-provider.js +73 -2
- package/components/forms/auth-admin-settings-labels.d.ts +1 -1
- package/components/forms/auth-admin-settings-labels.js +2 -2
- package/components/forms/form-descriptor-contract.d.ts +1 -1
- package/components/forms/form-descriptor-contract.js +1 -1
- package/components/forms/form-descriptor-runtime-client.d.ts +4 -1
- package/components/forms/form-descriptor-runtime-client.js +33 -11
- package/components/forms/form-media-limits.d.ts +12 -0
- package/components/forms/form-media-limits.js +14 -0
- package/components/forms/form-provider-registry.d.ts +8 -0
- package/components/forms/form-record-title.d.ts +14 -0
- package/components/forms/form-record-title.js +38 -0
- package/components/forms/form-widget-config.d.ts +3 -0
- package/components/forms/form-widget-config.js +2 -0
- package/components/forms/phi-form-widget.d.ts +1 -1
- package/components/forms/phi-form-widget.js +4 -0
- package/components/overlays/phi-overlay-container-client.js +8 -8
- package/components/overlays/phi-overlay-title.d.ts +7 -0
- package/components/overlays/phi-overlay-title.js +21 -0
- package/components/tables/client/phi-table-binding.d.ts +3 -1
- package/components/tables/client/phi-table-binding.js +90 -49
- package/components/tables/client/phi-table-filter-options.d.ts +27 -0
- package/components/tables/client/phi-table-filter-options.js +35 -0
- package/components/widgets/accessible-areas.d.ts +1 -1
- package/components/widgets/accessible-areas.js +1 -1
- package/components/widgets/client/shared/phi-choice-controller.js +22 -15
- package/components/widgets/client/shared/phi-rendered-value.d.ts +10 -0
- package/components/widgets/client/shared/phi-rendered-value.js +49 -1
- package/components/widgets/client/shared/phi-table-provider.d.ts +10 -1
- package/components/widgets/client/shared/phi-table-provider.js +22 -0
- package/components/widgets/label-sets/admin-users.d.ts +15 -0
- package/components/widgets/label-sets/admin-users.js +31 -0
- package/constants/core-data-provider-keys.d.ts +7 -0
- package/constants/core-data-provider-keys.js +7 -0
- package/constants/phi-base-role-metadata.d.ts +2 -2
- package/constants/phi-base-role-metadata.js +1 -1
- package/constants/runtime-module-ownership.js +3 -0
- package/forms.d.ts +1 -1
- package/forms.js +1 -1
- package/gateway/capability-media-limits.d.ts +10 -0
- package/gateway/capability-media-limits.js +40 -0
- package/gateway/server-capabilities.js +4 -0
- package/helpers/preset-tree-contract-check.d.ts +3 -2
- package/helpers/preset-tree-contract-check.js +60 -0
- package/helpers/record-title.d.ts +7 -0
- package/helpers/record-title.js +25 -0
- package/helpers/record-widget.d.ts +15 -0
- package/helpers/record-widget.js +57 -0
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/accounting/client-data-providers.js +9 -0
- package/plugins/runtime-modules/accounting/data-providers.d.ts +63 -0
- package/plugins/runtime-modules/accounting/data-providers.js +127 -0
- package/plugins/runtime-modules/accounting/definition.d.ts +54 -2
- package/plugins/runtime-modules/accounting/definition.js +5 -3
- package/plugins/runtime-modules/accounting/ids.d.ts +20 -0
- package/plugins/runtime-modules/accounting/ids.js +27 -0
- package/plugins/runtime-modules/accounting/module.d.ts +52 -0
- package/plugins/runtime-modules/accounting/presets.js +23 -4
- package/plugins/runtime-modules/accounting/services/products-table.d.ts +93 -0
- package/plugins/runtime-modules/accounting/services/products-table.js +158 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.d.ts +86 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +123 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.d.ts +21 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +435 -0
- package/plugins/runtime-modules/area-definitions.js +2 -2
- package/plugins/runtime-modules/asset/media-asset-field.d.ts +15 -0
- package/plugins/runtime-modules/asset/media-asset-field.js +21 -0
- package/plugins/runtime-modules/asset/media-asset-form-control.d.ts +4 -0
- package/plugins/runtime-modules/asset/media-asset-form-control.js +10 -5
- package/plugins/runtime-modules/asset/media-assets-field.d.ts +8 -0
- package/plugins/runtime-modules/asset/media-assets-field.js +10 -0
- package/plugins/runtime-modules/asset/media-assets-form-control.d.ts +5 -0
- package/plugins/runtime-modules/asset/media-assets-form-control.js +15 -6
- package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +11 -6
- package/plugins/runtime-modules/client-manifests/accounting.js +5 -1
- package/plugins/runtime-modules/core/cards.js +2 -2
- package/plugins/runtime-modules/core/client-data-providers.js +5 -0
- package/plugins/runtime-modules/core/data-providers.js +14 -0
- package/plugins/runtime-modules/core/services/site-members-options.d.ts +27 -0
- package/plugins/runtime-modules/core/services/site-members-options.js +55 -0
- package/plugins/runtime-modules/core/widgets/cascader/client.js +13 -12
- package/plugins/runtime-modules/core/widgets/checkbox-group/client.js +5 -4
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +5 -0
- package/plugins/runtime-modules/core/widgets/form/config.js +3 -0
- package/plugins/runtime-modules/core/widgets/multi-select/client.js +6 -4
- package/plugins/runtime-modules/core/widgets/record/actions.d.ts +20 -0
- package/plugins/runtime-modules/core/widgets/record/actions.js +77 -0
- package/plugins/runtime-modules/core/widgets/record/client.js +71 -8
- package/plugins/runtime-modules/core/widgets/record/config.d.ts +66 -1
- package/plugins/runtime-modules/core/widgets/record/config.js +71 -2
- package/plugins/runtime-modules/core/widgets/table/client.js +33 -29
- package/plugins/runtime-modules/core/widgets/table/config.js +5 -1
- package/plugins/runtime-modules/groups/data-providers.js +1 -1
- package/plugins/runtime-modules/groups/definition.js +1 -1
- package/plugins/runtime-modules/groups/page-visibility.d.ts +1 -1
- package/plugins/runtime-modules/groups/page-visibility.js +1 -1
- package/plugins/runtime-modules/groups/presets.js +1 -1
- package/plugins/runtime-modules/groups/services/options.js +1 -1
- package/plugins/runtime-modules/groups/services/table.js +1 -1
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -2
- package/plugins/runtime-modules/user-management/addon-roles.d.ts +60 -4
- package/plugins/runtime-modules/user-management/addon-roles.js +92 -8
- package/plugins/runtime-modules/user-management/addresses.d.ts +1 -1
- package/plugins/runtime-modules/user-management/controller/client.js +1 -1
- package/plugins/runtime-modules/user-management/data-providers.js +1 -0
- package/plugins/runtime-modules/user-management/forms.js +22 -0
- package/plugins/runtime-modules/user-management/presets.js +2 -2
- package/plugins/runtime-modules/user-management/services/options.d.ts +4 -0
- package/plugins/runtime-modules/user-management/services/options.js +14 -6
- package/plugins/runtime-modules/user-management/services/table.js +12 -3
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +9 -4
- package/types/access.d.ts +1 -1
- package/types/access.js +7 -7
- package/types/core-widget-placements.d.ts +7 -0
- package/types/form-descriptor.d.ts +1 -1
- package/types/record-widget.d.ts +35 -0
- package/types/server-capabilities.d.ts +1 -1
- package/types/table-widget.d.ts +20 -0
- package/types/table-widget.js +44 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { type PhiGlobalTranslatorOptions } from "../../../../gateway/tr";
|
|
3
|
+
export declare function getPhiAccountingProductsPageLabels(options: PhiGlobalTranslatorOptions): Promise<{
|
|
4
|
+
pageTitle: string;
|
|
5
|
+
pageDescription: string;
|
|
6
|
+
widgetLabel: string;
|
|
7
|
+
columns: {
|
|
8
|
+
picture: string;
|
|
9
|
+
title: string;
|
|
10
|
+
id: string;
|
|
11
|
+
supplier: string;
|
|
12
|
+
kind: string;
|
|
13
|
+
state: string;
|
|
14
|
+
sale: string;
|
|
15
|
+
free: string;
|
|
16
|
+
account: string;
|
|
17
|
+
parts: string;
|
|
18
|
+
waiting: string;
|
|
19
|
+
};
|
|
20
|
+
states: {
|
|
21
|
+
draft: string;
|
|
22
|
+
active: string;
|
|
23
|
+
withdrawn: string;
|
|
24
|
+
locked: string;
|
|
25
|
+
};
|
|
26
|
+
sales: {
|
|
27
|
+
own: string;
|
|
28
|
+
referral: string;
|
|
29
|
+
payout: string;
|
|
30
|
+
};
|
|
31
|
+
search: string;
|
|
32
|
+
filters: {
|
|
33
|
+
supplier: string;
|
|
34
|
+
supplierPlaceholder: string;
|
|
35
|
+
state: string;
|
|
36
|
+
waiting: string;
|
|
37
|
+
};
|
|
38
|
+
footer: string;
|
|
39
|
+
empty: {
|
|
40
|
+
title: string;
|
|
41
|
+
text: string;
|
|
42
|
+
};
|
|
43
|
+
actions: {
|
|
44
|
+
release: string;
|
|
45
|
+
lock: string;
|
|
46
|
+
unlock: string;
|
|
47
|
+
cancel: string;
|
|
48
|
+
};
|
|
49
|
+
release: {
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
lock: {
|
|
53
|
+
title: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
unlock: {
|
|
57
|
+
title: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
terms: {
|
|
61
|
+
title: string;
|
|
62
|
+
titleOf: string;
|
|
63
|
+
release: string;
|
|
64
|
+
product: string;
|
|
65
|
+
sale: {
|
|
66
|
+
inForce: string;
|
|
67
|
+
waiting: string;
|
|
68
|
+
};
|
|
69
|
+
referral: {
|
|
70
|
+
inForce: string;
|
|
71
|
+
waiting: string;
|
|
72
|
+
};
|
|
73
|
+
free: {
|
|
74
|
+
inForce: string;
|
|
75
|
+
waiting: string;
|
|
76
|
+
};
|
|
77
|
+
account: {
|
|
78
|
+
inForce: string;
|
|
79
|
+
waiting: string;
|
|
80
|
+
};
|
|
81
|
+
parts: {
|
|
82
|
+
inForce: string;
|
|
83
|
+
waiting: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
}>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../../gateway/tr";
|
|
3
|
+
import { definePhiRuntimeModuleLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../../gateway/label-set";
|
|
4
|
+
import { PHI_ACCOUNTING_RUNTIME_MODULE_IDENTITY } from "../ids";
|
|
5
|
+
/**
|
|
6
|
+
* What the product directory in the Accounting Area says: its frame, the Table's columns, filters and
|
|
7
|
+
* footer, the terms side by side in the dialog that releases them, and the three acts.
|
|
8
|
+
*/
|
|
9
|
+
const PHI_ACCOUNTING_PRODUCTS_PAGE_LABEL_SET = definePhiRuntimeModuleLabelSet(PHI_ACCOUNTING_RUNTIME_MODULE_IDENTITY, {
|
|
10
|
+
key: "preset:accounting-products-page",
|
|
11
|
+
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
12
|
+
labels: {
|
|
13
|
+
page_title: "Products",
|
|
14
|
+
page_description: definePhiMessageLabel("Every product the Site's Add-ons supply: release their terms, lock and unlock them."),
|
|
15
|
+
widget_label: "products",
|
|
16
|
+
column_picture: "Picture",
|
|
17
|
+
column_title: "Title",
|
|
18
|
+
column_id: "ID",
|
|
19
|
+
column_supplier: "Supplier",
|
|
20
|
+
column_kind: "Kind",
|
|
21
|
+
column_state: "State",
|
|
22
|
+
column_sale: "Sale",
|
|
23
|
+
column_free: "Free",
|
|
24
|
+
column_account: "Account required",
|
|
25
|
+
column_parts: "Bundle parts",
|
|
26
|
+
column_waiting: "Terms waiting",
|
|
27
|
+
state_draft: "Draft",
|
|
28
|
+
state_active: "Active",
|
|
29
|
+
state_withdrawn: "Withdrawn",
|
|
30
|
+
state_locked: "Locked",
|
|
31
|
+
sale_own: "Own",
|
|
32
|
+
sale_referral: "Referral",
|
|
33
|
+
sale_payout: "Payout",
|
|
34
|
+
search_placeholder: "Title or ID",
|
|
35
|
+
filter_supplier: "Supplier",
|
|
36
|
+
filter_supplier_placeholder: "@scope/name",
|
|
37
|
+
filter_state: "State",
|
|
38
|
+
filter_waiting: "Terms waiting",
|
|
39
|
+
footer: "%1 products",
|
|
40
|
+
empty_title: definePhiMessageLabel("No product matches."),
|
|
41
|
+
empty_text: definePhiMessageLabel("The Site's Add-ons register their products here; none does yet, or the filters leave none."),
|
|
42
|
+
action_release: "Release terms",
|
|
43
|
+
action_lock: "Lock",
|
|
44
|
+
action_unlock: "Unlock",
|
|
45
|
+
action_cancel: "Cancel",
|
|
46
|
+
release_description: definePhiMessageLabel("The terms waiting for release take effect now, and the Add-ons that sell it are told."),
|
|
47
|
+
lock_title: "Lock %1?",
|
|
48
|
+
lock_description: definePhiMessageLabel("Nobody can acquire it, and no entitlement to it counts while it is locked. Its supplier cannot undo it."),
|
|
49
|
+
unlock_title: "Unlock %1?",
|
|
50
|
+
unlock_description: definePhiMessageLabel("It becomes withdrawn: entitlements count again, nobody acquires it until its supplier makes it active."),
|
|
51
|
+
terms_title: "Terms",
|
|
52
|
+
terms_title_of: "Terms: %1",
|
|
53
|
+
terms_release: "Release",
|
|
54
|
+
terms_product: "Product",
|
|
55
|
+
terms_sale_in_force: "Sale in force",
|
|
56
|
+
terms_sale_waiting: "Sale waiting for release",
|
|
57
|
+
terms_referral_in_force: "Referral address in force",
|
|
58
|
+
terms_referral_waiting: "Referral address waiting for release",
|
|
59
|
+
terms_free_in_force: "Free in force",
|
|
60
|
+
terms_free_waiting: "Free waiting for release",
|
|
61
|
+
terms_account_in_force: "Account required in force",
|
|
62
|
+
terms_account_waiting: "Account required waiting for release",
|
|
63
|
+
terms_parts_in_force: "Bundle parts in force",
|
|
64
|
+
terms_parts_waiting: "Bundle parts waiting for release",
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
export async function getPhiAccountingProductsPageLabels(options) {
|
|
68
|
+
const labels = await getPhiLabelSet(options, PHI_ACCOUNTING_PRODUCTS_PAGE_LABEL_SET);
|
|
69
|
+
return {
|
|
70
|
+
pageTitle: labels.page_title,
|
|
71
|
+
pageDescription: labels.page_description,
|
|
72
|
+
widgetLabel: labels.widget_label,
|
|
73
|
+
columns: {
|
|
74
|
+
picture: labels.column_picture,
|
|
75
|
+
title: labels.column_title,
|
|
76
|
+
id: labels.column_id,
|
|
77
|
+
supplier: labels.column_supplier,
|
|
78
|
+
kind: labels.column_kind,
|
|
79
|
+
state: labels.column_state,
|
|
80
|
+
sale: labels.column_sale,
|
|
81
|
+
free: labels.column_free,
|
|
82
|
+
account: labels.column_account,
|
|
83
|
+
parts: labels.column_parts,
|
|
84
|
+
waiting: labels.column_waiting,
|
|
85
|
+
},
|
|
86
|
+
states: {
|
|
87
|
+
draft: labels.state_draft,
|
|
88
|
+
active: labels.state_active,
|
|
89
|
+
withdrawn: labels.state_withdrawn,
|
|
90
|
+
locked: labels.state_locked,
|
|
91
|
+
},
|
|
92
|
+
sales: { own: labels.sale_own, referral: labels.sale_referral, payout: labels.sale_payout },
|
|
93
|
+
search: labels.search_placeholder,
|
|
94
|
+
filters: {
|
|
95
|
+
supplier: labels.filter_supplier,
|
|
96
|
+
supplierPlaceholder: labels.filter_supplier_placeholder,
|
|
97
|
+
state: labels.filter_state,
|
|
98
|
+
waiting: labels.filter_waiting,
|
|
99
|
+
},
|
|
100
|
+
footer: labels.footer,
|
|
101
|
+
empty: { title: labels.empty_title, text: labels.empty_text },
|
|
102
|
+
actions: {
|
|
103
|
+
release: labels.action_release,
|
|
104
|
+
lock: labels.action_lock,
|
|
105
|
+
unlock: labels.action_unlock,
|
|
106
|
+
cancel: labels.action_cancel,
|
|
107
|
+
},
|
|
108
|
+
release: { description: labels.release_description },
|
|
109
|
+
lock: { title: labels.lock_title, description: labels.lock_description },
|
|
110
|
+
unlock: { title: labels.unlock_title, description: labels.unlock_description },
|
|
111
|
+
terms: {
|
|
112
|
+
title: labels.terms_title,
|
|
113
|
+
titleOf: labels.terms_title_of,
|
|
114
|
+
release: labels.terms_release,
|
|
115
|
+
product: labels.terms_product,
|
|
116
|
+
sale: { inForce: labels.terms_sale_in_force, waiting: labels.terms_sale_waiting },
|
|
117
|
+
referral: { inForce: labels.terms_referral_in_force, waiting: labels.terms_referral_waiting },
|
|
118
|
+
free: { inForce: labels.terms_free_in_force, waiting: labels.terms_free_waiting },
|
|
119
|
+
account: { inForce: labels.terms_account_in_force, waiting: labels.terms_account_waiting },
|
|
120
|
+
parts: { inForce: labels.terms_parts_in_force, waiting: labels.terms_parts_waiting },
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PhiCmsPageNode, PhiResolvedCmsPageTree } from "../../../../types/cms";
|
|
2
|
+
import type { PhiBlockRuntime } from "../../../../types";
|
|
3
|
+
/**
|
|
4
|
+
* The Site's product directory (phis-server SERVER_ADDONS.md, `products:v1`).
|
|
5
|
+
*
|
|
6
|
+
* Every product of every supplier Add-on, in every state, for whoever the Accounting Area lets in --
|
|
7
|
+
* Admin, Maintainer and Accountant, the holders of Core's `accounting` access, which is also what Core
|
|
8
|
+
* asks of each act. The operator releases a publisher's terms and locks or unlocks; title, summary and
|
|
9
|
+
* picture stay the supplier's and are not edited here.
|
|
10
|
+
*
|
|
11
|
+
* The picture is a small column of its own and the icon stands ahead of the title, both the server's `icon`
|
|
12
|
+
* variant (`imageListPath`, `iconListPath`: 64 x 64, fitted whole, with their cache revisions).
|
|
13
|
+
* Releasing opens a dialog named after the product, whose record sets the terms in force beside the ones
|
|
14
|
+
* waiting; its Release runs the Provider's release on that record, and the dialog closes and the Table
|
|
15
|
+
* reads again. The dialog is the confirmation, so the release asks nothing more; lock and unlock stay the
|
|
16
|
+
* row's own acts with a question naming the product.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildPhiDefaultAccountingProductsPageTree({ page, runtime, }: {
|
|
19
|
+
page: PhiCmsPageNode;
|
|
20
|
+
runtime: PhiBlockRuntime;
|
|
21
|
+
}): Promise<PhiResolvedCmsPageTree>;
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { PHI_CMS_DEFAULT_SLOT_INDEX } from "../../../../constants/cms-layout-types";
|
|
2
|
+
import { PhiCmsFlags, PhiCmsPageType } from "../../../../constants/phi-cms";
|
|
3
|
+
import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
|
|
4
|
+
import { createPhiSignalAddress, PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../types/signals";
|
|
5
|
+
import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID, } from "../../../../components/regions/presets/phi-base-page-layout";
|
|
6
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
7
|
+
import { PHI_ACCOUNTING_PRODUCTS_DATA_PROVIDER_KEY, PHI_ACCOUNTING_PRODUCTS_PAGE_LAYOUT_IDS, PHI_ACCOUNTING_PRODUCTS_PAGE_OVERLAY_IDS, PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS, PHI_ACCOUNTING_PRODUCTS_RESOURCE_KEY, } from "../ids";
|
|
8
|
+
import { getPhiAccountingProductsPageLabels } from "./accounting-products-label-set";
|
|
9
|
+
const SYNTHETIC_ACCOUNTING_PRODUCTS_REGION_IDS = { regionContent: -571 };
|
|
10
|
+
/**
|
|
11
|
+
* The row action that opens the terms side by side, and the Provider action the dialog's Release runs: the
|
|
12
|
+
* dialog and its record answer to the row's announcement, the record runs the action of the same key.
|
|
13
|
+
*/
|
|
14
|
+
const RELEASE_ACTION_KEY = "release";
|
|
15
|
+
const STATE_COLORS = {
|
|
16
|
+
draft: "default",
|
|
17
|
+
active: "success",
|
|
18
|
+
withdrawn: "warning",
|
|
19
|
+
locked: "error",
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The Site's product directory (phis-server SERVER_ADDONS.md, `products:v1`).
|
|
23
|
+
*
|
|
24
|
+
* Every product of every supplier Add-on, in every state, for whoever the Accounting Area lets in --
|
|
25
|
+
* Admin, Maintainer and Accountant, the holders of Core's `accounting` access, which is also what Core
|
|
26
|
+
* asks of each act. The operator releases a publisher's terms and locks or unlocks; title, summary and
|
|
27
|
+
* picture stay the supplier's and are not edited here.
|
|
28
|
+
*
|
|
29
|
+
* The picture is a small column of its own and the icon stands ahead of the title, both the server's `icon`
|
|
30
|
+
* variant (`imageListPath`, `iconListPath`: 64 x 64, fitted whole, with their cache revisions).
|
|
31
|
+
* Releasing opens a dialog named after the product, whose record sets the terms in force beside the ones
|
|
32
|
+
* waiting; its Release runs the Provider's release on that record, and the dialog closes and the Table
|
|
33
|
+
* reads again. The dialog is the confirmation, so the release asks nothing more; lock and unlock stay the
|
|
34
|
+
* row's own acts with a question naming the product.
|
|
35
|
+
*/
|
|
36
|
+
export async function buildPhiDefaultAccountingProductsPageTree({ page, runtime, }) {
|
|
37
|
+
const labels = await getPhiAccountingProductsPageLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
38
|
+
const scaffold = buildPhiBasePageContentScaffold({
|
|
39
|
+
page,
|
|
40
|
+
regionId: SYNTHETIC_ACCOUNTING_PRODUCTS_REGION_IDS.regionContent,
|
|
41
|
+
});
|
|
42
|
+
const nodes = createPhiCmsPresetNodes(page);
|
|
43
|
+
const termsOverlayAddress = createPhiSignalAddress("cms", PHI_ACCOUNTING_PRODUCTS_PAGE_OVERLAY_IDS.overlayTerms);
|
|
44
|
+
const termsRecordAddress = createPhiSignalAddress("cms", PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS.widgetTerms);
|
|
45
|
+
const tableAddress = createPhiSignalAddress("cms", PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS.widgetTable);
|
|
46
|
+
const columns = [
|
|
47
|
+
{
|
|
48
|
+
key: "picture",
|
|
49
|
+
fieldKey: "imageListPath",
|
|
50
|
+
title: labels.columns.picture,
|
|
51
|
+
renderer: "image",
|
|
52
|
+
sizing: { mode: "content" },
|
|
53
|
+
},
|
|
54
|
+
// The icon stands for the product, so it stands ahead of its name rather than in a column of its own.
|
|
55
|
+
{
|
|
56
|
+
key: "title",
|
|
57
|
+
fieldKey: "title",
|
|
58
|
+
imageFieldKey: "iconListPath",
|
|
59
|
+
title: labels.columns.title,
|
|
60
|
+
sizing: { mode: "fill", minWidth: 200 },
|
|
61
|
+
},
|
|
62
|
+
{ key: "id", fieldKey: "id", title: labels.columns.id, renderer: "code", sizing: { mode: "content" } },
|
|
63
|
+
{ key: "supplier", fieldKey: "supplier", title: labels.columns.supplier, renderer: "code", sizing: { mode: "content" } },
|
|
64
|
+
{ key: "type", fieldKey: "type", title: labels.columns.kind, renderer: "badge", sizing: { mode: "content" } },
|
|
65
|
+
{
|
|
66
|
+
key: "state",
|
|
67
|
+
fieldKey: "state",
|
|
68
|
+
title: labels.columns.state,
|
|
69
|
+
renderer: "badge",
|
|
70
|
+
valueMap: labels.states,
|
|
71
|
+
tagColorMap: STATE_COLORS,
|
|
72
|
+
sizing: { mode: "content" },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
key: "sale",
|
|
76
|
+
fieldKey: "sale",
|
|
77
|
+
title: labels.columns.sale,
|
|
78
|
+
renderer: "badge",
|
|
79
|
+
valueMap: labels.sales,
|
|
80
|
+
sizing: { mode: "content" },
|
|
81
|
+
},
|
|
82
|
+
{ key: "free", fieldKey: "free", title: labels.columns.free, renderer: "checkbox", sizing: { mode: "content" } },
|
|
83
|
+
{
|
|
84
|
+
key: "accountRequired",
|
|
85
|
+
fieldKey: "accountRequired",
|
|
86
|
+
title: labels.columns.account,
|
|
87
|
+
renderer: "checkbox",
|
|
88
|
+
sizing: { mode: "content" },
|
|
89
|
+
},
|
|
90
|
+
{ key: "partCount", fieldKey: "partCount", title: labels.columns.parts, align: "right", sizing: { mode: "content" } },
|
|
91
|
+
{
|
|
92
|
+
key: "awaitingRelease",
|
|
93
|
+
fieldKey: "awaitingRelease",
|
|
94
|
+
title: labels.columns.waiting,
|
|
95
|
+
renderer: "checkbox",
|
|
96
|
+
sizing: { mode: "content" },
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
// In force on the left, waiting on the right: the record's two columns are the comparison.
|
|
100
|
+
const termField = (key, text, presentation) => [
|
|
101
|
+
{ key: `inForce${key}`, fieldKey: `inForce${key}`, label: text.inForce, ...presentation },
|
|
102
|
+
{ key: `pending${key}`, fieldKey: `pending${key}`, label: text.waiting, ...presentation },
|
|
103
|
+
];
|
|
104
|
+
const termsDialog = nodes.dialog({
|
|
105
|
+
id: PHI_ACCOUNTING_PRODUCTS_PAGE_OVERLAY_IDS.overlayTerms,
|
|
106
|
+
bodyLayoutNodeId: PHI_ACCOUNTING_PRODUCTS_PAGE_LAYOUT_IDS.layoutTerms,
|
|
107
|
+
sortOrder: 0,
|
|
108
|
+
label: "accounting product terms modal",
|
|
109
|
+
body: { config: { anchor: { horizontal: "left", vertical: "top" } } },
|
|
110
|
+
config: {
|
|
111
|
+
// Until the record names the product ("Terms: @acme/books:pro").
|
|
112
|
+
title: labels.terms.title,
|
|
113
|
+
mountPolicy: "lazy-keep",
|
|
114
|
+
// Which row action this dialog is for; left unsaid, a Table action opens nothing.
|
|
115
|
+
openActionKey: RELEASE_ACTION_KEY,
|
|
116
|
+
signalRoutes: {
|
|
117
|
+
emits: [{
|
|
118
|
+
routeKey: "accounting-products-terms-open-change",
|
|
119
|
+
capabilityId: "openChange",
|
|
120
|
+
scope: "page",
|
|
121
|
+
channel: "state",
|
|
122
|
+
action: "change",
|
|
123
|
+
valueType: "boolean",
|
|
124
|
+
receiver: termsRecordAddress,
|
|
125
|
+
}],
|
|
126
|
+
listens: [{
|
|
127
|
+
routeKey: "accounting-products-terms-open",
|
|
128
|
+
capabilityId: "open",
|
|
129
|
+
scope: "page",
|
|
130
|
+
channel: "action",
|
|
131
|
+
action: "activate",
|
|
132
|
+
valueType: "json",
|
|
133
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
134
|
+
receiver: termsOverlayAddress,
|
|
135
|
+
}, {
|
|
136
|
+
routeKey: "accounting-products-terms-title",
|
|
137
|
+
capabilityId: "title",
|
|
138
|
+
scope: "page",
|
|
139
|
+
channel: "title",
|
|
140
|
+
action: "change",
|
|
141
|
+
valueType: "string",
|
|
142
|
+
receiver: termsOverlayAddress,
|
|
143
|
+
}, {
|
|
144
|
+
routeKey: "accounting-products-terms-close",
|
|
145
|
+
capabilityId: "close",
|
|
146
|
+
scope: "page",
|
|
147
|
+
channel: "dialog",
|
|
148
|
+
action: "close",
|
|
149
|
+
valueType: "none",
|
|
150
|
+
receiver: termsOverlayAddress,
|
|
151
|
+
}],
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
commands: {
|
|
155
|
+
footerLayoutNodeId: PHI_ACCOUNTING_PRODUCTS_PAGE_LAYOUT_IDS.layoutTermsFooter,
|
|
156
|
+
widgetId: PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS.widgetTermsCommands,
|
|
157
|
+
label: "accounting product terms commands",
|
|
158
|
+
// The Label Set's words, already in the reader's language.
|
|
159
|
+
flags: PhiCmsFlags.NoTranslate,
|
|
160
|
+
config: {
|
|
161
|
+
key: "accounting-products-terms-commands",
|
|
162
|
+
buttons: [
|
|
163
|
+
{ key: "cancel", emits: [{ capabilityId: "close", value: null }], label: labels.actions.cancel, icon: "close" },
|
|
164
|
+
{
|
|
165
|
+
key: "release",
|
|
166
|
+
// The record runs the action of this key on the product it shows.
|
|
167
|
+
emits: [{ capabilityId: "release", value: RELEASE_ACTION_KEY }],
|
|
168
|
+
label: labels.terms.release,
|
|
169
|
+
variant: "primary",
|
|
170
|
+
icon: "antd:safety-certificate",
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
signalRoutes: {
|
|
174
|
+
emits: [{
|
|
175
|
+
routeKey: "accounting-products-terms-cancel",
|
|
176
|
+
capabilityId: "close",
|
|
177
|
+
scope: "page",
|
|
178
|
+
channel: "dialog",
|
|
179
|
+
action: "close",
|
|
180
|
+
valueType: "none",
|
|
181
|
+
receiver: termsOverlayAddress,
|
|
182
|
+
}, {
|
|
183
|
+
routeKey: "accounting-products-terms-release",
|
|
184
|
+
capabilityId: "release",
|
|
185
|
+
scope: "page",
|
|
186
|
+
channel: "action",
|
|
187
|
+
action: "activate",
|
|
188
|
+
valueType: "string",
|
|
189
|
+
receiver: termsRecordAddress,
|
|
190
|
+
}],
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
return {
|
|
196
|
+
page: nodes.page({ pageType: PhiCmsPageType.Standard }),
|
|
197
|
+
pageMeta: {
|
|
198
|
+
title: { msgId: 0, source: "Products", value: labels.pageTitle },
|
|
199
|
+
description: {
|
|
200
|
+
msgId: 0,
|
|
201
|
+
source: "Every product the Site's Add-ons supply: release their terms, lock and unlock them.",
|
|
202
|
+
value: labels.pageDescription,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
overlays: [termsDialog.overlay],
|
|
206
|
+
regions: [scaffold.region],
|
|
207
|
+
layoutNodes: [scaffold.layoutNode, ...termsDialog.layouts],
|
|
208
|
+
contentWidgets: [
|
|
209
|
+
nodes.widget({
|
|
210
|
+
id: PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS.widgetTable,
|
|
211
|
+
parentLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
|
|
212
|
+
typeKey: "table",
|
|
213
|
+
slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
214
|
+
sortOrder: 0,
|
|
215
|
+
label: labels.widgetLabel,
|
|
216
|
+
config: {
|
|
217
|
+
source: {
|
|
218
|
+
providerKey: PHI_ACCOUNTING_PRODUCTS_DATA_PROVIDER_KEY,
|
|
219
|
+
resourceKey: PHI_ACCOUNTING_PRODUCTS_RESOURCE_KEY,
|
|
220
|
+
},
|
|
221
|
+
presentation: {
|
|
222
|
+
layout: { mode: "auto", overflowX: "auto" },
|
|
223
|
+
columns,
|
|
224
|
+
footer: {
|
|
225
|
+
template: labels.footer,
|
|
226
|
+
values: [{ key: "products", value: { source: "core", fieldKey: "totalRows" } }],
|
|
227
|
+
align: "start",
|
|
228
|
+
},
|
|
229
|
+
emptyState: { title: labels.empty.title, description: labels.empty.text },
|
|
230
|
+
controlSize: "small",
|
|
231
|
+
},
|
|
232
|
+
features: {
|
|
233
|
+
search: { enabled: true, placeholder: labels.search, debounceMs: 250 },
|
|
234
|
+
filters: [
|
|
235
|
+
{
|
|
236
|
+
key: "supplier",
|
|
237
|
+
type: "text",
|
|
238
|
+
label: labels.filters.supplier,
|
|
239
|
+
placeholder: labels.filters.supplierPlaceholder,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
key: "state",
|
|
243
|
+
type: "select",
|
|
244
|
+
multiple: true,
|
|
245
|
+
label: labels.filters.state,
|
|
246
|
+
options: ["draft", "active", "withdrawn", "locked"]
|
|
247
|
+
.map((value) => ({ value, label: labels.states[value] })),
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
key: "pendingTerms",
|
|
251
|
+
type: "boolean",
|
|
252
|
+
control: "switch",
|
|
253
|
+
label: labels.filters.waiting,
|
|
254
|
+
labelPlacement: "inline",
|
|
255
|
+
defaultValue: false,
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
pagination: { enabled: true, pageSize: 25, pageSizes: [25, 50, 100] },
|
|
259
|
+
sorting: { mode: "none" },
|
|
260
|
+
tools: { mode: "self-contained", reload: true },
|
|
261
|
+
actions: {
|
|
262
|
+
rowLayout: "compact",
|
|
263
|
+
row: [
|
|
264
|
+
{
|
|
265
|
+
// Opens the terms dialog, whose Release runs the Provider's action of this key.
|
|
266
|
+
key: RELEASE_ACTION_KEY,
|
|
267
|
+
label: labels.actions.release,
|
|
268
|
+
icon: "antd:safety-certificate",
|
|
269
|
+
display: "icon",
|
|
270
|
+
execution: "signal",
|
|
271
|
+
disabledWhen: { source: "row", valuePath: "awaitingRelease", operator: "falsy" },
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
key: "lock",
|
|
275
|
+
label: labels.actions.lock,
|
|
276
|
+
icon: "antd:lock",
|
|
277
|
+
display: "icon",
|
|
278
|
+
mode: "danger",
|
|
279
|
+
execution: "provider",
|
|
280
|
+
disabledWhen: { source: "row", valuePath: "locked", operator: "truthy" },
|
|
281
|
+
confirm: {
|
|
282
|
+
title: labels.lock.title,
|
|
283
|
+
description: labels.lock.description,
|
|
284
|
+
okText: labels.actions.lock,
|
|
285
|
+
cancelText: labels.actions.cancel,
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
key: "unlock",
|
|
290
|
+
label: labels.actions.unlock,
|
|
291
|
+
icon: "antd:unlock",
|
|
292
|
+
display: "icon",
|
|
293
|
+
execution: "provider",
|
|
294
|
+
disabledWhen: { source: "row", valuePath: "locked", operator: "falsy" },
|
|
295
|
+
confirm: {
|
|
296
|
+
title: labels.unlock.title,
|
|
297
|
+
description: labels.unlock.description,
|
|
298
|
+
okText: labels.actions.unlock,
|
|
299
|
+
cancelText: labels.actions.cancel,
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
signalRoutes: {
|
|
306
|
+
emits: [{
|
|
307
|
+
routeKey: "accounting-products-table-terms-record",
|
|
308
|
+
capabilityId: "actionActivate",
|
|
309
|
+
scope: "page",
|
|
310
|
+
channel: "action",
|
|
311
|
+
action: "activate",
|
|
312
|
+
valueType: "json",
|
|
313
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
314
|
+
receiver: termsRecordAddress,
|
|
315
|
+
}, {
|
|
316
|
+
routeKey: "accounting-products-table-terms-overlay",
|
|
317
|
+
capabilityId: "actionActivate",
|
|
318
|
+
scope: "page",
|
|
319
|
+
channel: "action",
|
|
320
|
+
action: "activate",
|
|
321
|
+
valueType: "json",
|
|
322
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
323
|
+
receiver: termsOverlayAddress,
|
|
324
|
+
}],
|
|
325
|
+
// Read again once the dialog released a product's terms.
|
|
326
|
+
listens: [{
|
|
327
|
+
routeKey: "accounting-products-table-reload",
|
|
328
|
+
capabilityId: "reload",
|
|
329
|
+
scope: "page",
|
|
330
|
+
channel: "reload",
|
|
331
|
+
action: "activate",
|
|
332
|
+
valueType: "none",
|
|
333
|
+
receiver: tableAddress,
|
|
334
|
+
}],
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
}),
|
|
338
|
+
...termsDialog.widgets,
|
|
339
|
+
// What the release does, which the row's own question used to say.
|
|
340
|
+
nodes.widget({
|
|
341
|
+
id: PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS.widgetTermsNote,
|
|
342
|
+
parentLayoutNodeId: PHI_ACCOUNTING_PRODUCTS_PAGE_LAYOUT_IDS.layoutTerms,
|
|
343
|
+
typeKey: "simple-text",
|
|
344
|
+
slotIndex: 0,
|
|
345
|
+
label: "accounting product terms note",
|
|
346
|
+
flags: PhiCmsFlags.NoTranslate,
|
|
347
|
+
config: { text: labels.release.description, tone: "secondary" },
|
|
348
|
+
}),
|
|
349
|
+
nodes.widget({
|
|
350
|
+
id: PHI_ACCOUNTING_PRODUCTS_PAGE_WIDGET_IDS.widgetTerms,
|
|
351
|
+
parentLayoutNodeId: PHI_ACCOUNTING_PRODUCTS_PAGE_LAYOUT_IDS.layoutTerms,
|
|
352
|
+
typeKey: "record",
|
|
353
|
+
slotIndex: 1,
|
|
354
|
+
label: "accounting product terms record",
|
|
355
|
+
config: {
|
|
356
|
+
source: {
|
|
357
|
+
providerKey: PHI_ACCOUNTING_PRODUCTS_DATA_PROVIDER_KEY,
|
|
358
|
+
resourceKey: PHI_ACCOUNTING_PRODUCTS_RESOURCE_KEY,
|
|
359
|
+
},
|
|
360
|
+
openActionKey: RELEASE_ACTION_KEY,
|
|
361
|
+
// The dialog's Release: the Provider's release, on the product shown.
|
|
362
|
+
actions: [{ key: RELEASE_ACTION_KEY }],
|
|
363
|
+
titleFromRecord: { template: labels.terms.titleOf, field: "id" },
|
|
364
|
+
presentation: {
|
|
365
|
+
appearance: "grid",
|
|
366
|
+
columns: 2,
|
|
367
|
+
fields: [
|
|
368
|
+
{ key: "title", fieldKey: "title", label: labels.terms.product, full: true },
|
|
369
|
+
{ key: "id", fieldKey: "id", label: labels.columns.id, renderer: "code", full: true },
|
|
370
|
+
...termField("Sale", labels.terms.sale, { renderer: "badge", valueMap: labels.sales }),
|
|
371
|
+
...termField("ReferralUrl", labels.terms.referral, { renderer: "link" }),
|
|
372
|
+
...termField("Free", labels.terms.free, { renderer: "checkbox" }),
|
|
373
|
+
...termField("AccountRequired", labels.terms.account, { renderer: "checkbox" }),
|
|
374
|
+
...termField("Parts", labels.terms.parts, { renderer: "tags" }),
|
|
375
|
+
],
|
|
376
|
+
},
|
|
377
|
+
signalRoutes: {
|
|
378
|
+
emits: [{
|
|
379
|
+
routeKey: "accounting-products-terms-record-title",
|
|
380
|
+
capabilityId: "recordTitle",
|
|
381
|
+
scope: "page",
|
|
382
|
+
channel: "title",
|
|
383
|
+
action: "change",
|
|
384
|
+
valueType: "string",
|
|
385
|
+
receiver: termsOverlayAddress,
|
|
386
|
+
}, {
|
|
387
|
+
// Released: the dialog is done, and the row has left what the filters may show.
|
|
388
|
+
routeKey: "accounting-products-terms-released-close",
|
|
389
|
+
capabilityId: "actionSuccess",
|
|
390
|
+
scope: "page",
|
|
391
|
+
channel: "dialog",
|
|
392
|
+
action: "close",
|
|
393
|
+
valueType: "none",
|
|
394
|
+
receiver: termsOverlayAddress,
|
|
395
|
+
}, {
|
|
396
|
+
routeKey: "accounting-products-terms-released-reload",
|
|
397
|
+
capabilityId: "actionSuccess",
|
|
398
|
+
scope: "page",
|
|
399
|
+
channel: "reload",
|
|
400
|
+
action: "activate",
|
|
401
|
+
valueType: "none",
|
|
402
|
+
receiver: tableAddress,
|
|
403
|
+
}],
|
|
404
|
+
listens: [{
|
|
405
|
+
routeKey: "accounting-products-terms-record-open",
|
|
406
|
+
capabilityId: "recordOpen",
|
|
407
|
+
scope: "page",
|
|
408
|
+
channel: "action",
|
|
409
|
+
action: "activate",
|
|
410
|
+
valueType: "json",
|
|
411
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
412
|
+
receiver: termsRecordAddress,
|
|
413
|
+
}, {
|
|
414
|
+
routeKey: "accounting-products-terms-record-closed",
|
|
415
|
+
capabilityId: "close",
|
|
416
|
+
scope: "page",
|
|
417
|
+
channel: "state",
|
|
418
|
+
action: "change",
|
|
419
|
+
valueType: "boolean",
|
|
420
|
+
receiver: termsRecordAddress,
|
|
421
|
+
}, {
|
|
422
|
+
routeKey: "accounting-products-terms-record-release",
|
|
423
|
+
capabilityId: "actionActivate",
|
|
424
|
+
scope: "page",
|
|
425
|
+
channel: "action",
|
|
426
|
+
action: "activate",
|
|
427
|
+
valueType: "string",
|
|
428
|
+
receiver: termsRecordAddress,
|
|
429
|
+
}],
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
}),
|
|
433
|
+
],
|
|
434
|
+
};
|
|
435
|
+
}
|