@enyxs/wikex-components 0.11.21 → 0.11.23
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/README.md +163 -0
- package/dist/chrome-model-BZjSLS8a.d.mts +74 -0
- package/dist/chrome-model-CAlcJpU4.d.ts +74 -0
- package/dist/chrome-model.d.mts +3 -0
- package/dist/chrome-model.d.ts +3 -0
- package/dist/chrome-model.js +1165 -0
- package/dist/chrome-model.js.map +1 -0
- package/dist/chrome-model.mjs +1138 -0
- package/dist/chrome-model.mjs.map +1 -0
- package/dist/index.d.mts +5 -70
- package/dist/index.d.ts +5 -70
- package/dist/index.js +10952 -10898
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10946 -10893
- package/dist/index.mjs.map +1 -1
- package/dist/manifest.json +512 -67
- package/package.json +6 -1
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# @enyxs/wikex-components
|
|
2
|
+
|
|
3
|
+
Reusable Material UI blocks with CMS metadata and inline-edit support.
|
|
4
|
+
|
|
5
|
+
## Included blocks
|
|
6
|
+
|
|
7
|
+
- `hero-banner`
|
|
8
|
+
- `feature-grid`
|
|
9
|
+
- `image-text`
|
|
10
|
+
- `call-to-action`
|
|
11
|
+
- `announcement-bar`
|
|
12
|
+
- `metrics-strip`
|
|
13
|
+
- `testimonial-grid`
|
|
14
|
+
- `faq-section`
|
|
15
|
+
- `pricing-plans`
|
|
16
|
+
- `logo-cloud`
|
|
17
|
+
- `site-header` (Minimal UI)
|
|
18
|
+
- `centered-header` (Minimal UI)
|
|
19
|
+
- `utility-header` (Minimal UI)
|
|
20
|
+
- `site-footer` (Minimal UI)
|
|
21
|
+
- `compact-footer` (Minimal UI)
|
|
22
|
+
- `newsletter-footer` (Minimal UI)
|
|
23
|
+
- `social-footer` (Minimal UI)
|
|
24
|
+
- `download-section` (Wikex)
|
|
25
|
+
- Bộ section Wikex Commodity cho landing, giới thiệu, chính sách, khiếu nại,
|
|
26
|
+
thông tin, thông báo MXV, sản phẩm, biểu phí và coming-soon
|
|
27
|
+
|
|
28
|
+
Các block Wikex Commodity thuộc category `wikex`, cho phép admin hiển thị riêng
|
|
29
|
+
thư viện component của website hàng hóa.
|
|
30
|
+
|
|
31
|
+
Package cũng export `wikexCommodityPageTemplates` và `wikexCommodityRoutes` từ
|
|
32
|
+
entry `@enyxs/wikex-components/page-templates`. Đây là nguồn route/template dùng
|
|
33
|
+
chung giữa frontend và CMS, không kéo Material UI vào code chỉ cần metadata route.
|
|
34
|
+
|
|
35
|
+
Wikex download assets are stored in `src/wikex/assets/download-section/`. Replace the placeholder
|
|
36
|
+
files there, then update `src/wikex/download-assets.ts` if the filenames or formats change.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
Before publishing to an npm registry, consume the versioned GitLab package:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install git+ssh://git@gitlab.com/tamenyxs/wikex-components.git#v0.8.1
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Use with a CMS registry
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { wikexCmsBlocks } from "@enyxs/wikex-components";
|
|
50
|
+
|
|
51
|
+
export const cmsCodeBlocks = [...wikexCmsBlocks];
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The package has React, Material UI and Emotion as peer dependencies, so the host app owns their versions.
|
|
55
|
+
|
|
56
|
+
## Release
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm run check
|
|
60
|
+
npm run build
|
|
61
|
+
git tag v0.8.1
|
|
62
|
+
git push origin main --tags
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Editable fees and margin table
|
|
67
|
+
|
|
68
|
+
`commodity-fees` supports editing every data cell and column title in CMS preview,
|
|
69
|
+
adding/removing rows and columns with confirmation dialogs, and selecting multiple tags per row with MUI Select.
|
|
70
|
+
Search ignores Vietnamese accents and searches commodity names/codes. Tag and
|
|
71
|
+
search filters are combined before pagination (25 rows per page by default; selectable 5/10/25/50/100/all). Adding a row
|
|
72
|
+
clears filters and opens its page. Deleting all rows keeps the table empty.
|
|
73
|
+
|
|
74
|
+
CMS stores the table as JSON strings in `vi.feesTable` and `en.feesTable`, so the
|
|
75
|
+
existing page save/publish flow persists it without separate database tables.
|
|
76
|
+
Old pages retain their original sample table until edited. Visitors only get
|
|
77
|
+
search, tag filters and pagination, with no editing controls.
|
|
78
|
+
|
|
79
|
+
For another app, import `FeesTable` and `FeesTableData` from
|
|
80
|
+
`@enyxs/wikex-components`. Pass controlled `value`, `onChange`, and `editable`.
|
|
81
|
+
The component supplies its table theme; provide the package's existing icon
|
|
82
|
+
assets for pagination, as with other Wikex components. Run `npm run test:fees`
|
|
83
|
+
for data/search/pagination regression checks.
|
|
84
|
+
|
|
85
|
+
Create tags from the toolbar dialog; unassigned tags persist in the table catalog.
|
|
86
|
+
Editor textareas automatically fit their text. Header actions share an aligned row.
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Product UI and shared controls
|
|
90
|
+
|
|
91
|
+
Import product UI from `@enyxs/wikex-components/products` and standalone
|
|
92
|
+
`ProductCard`, `Pagination`, `Breadcrumb` (with their prop types) from
|
|
93
|
+
`@enyxs/wikex-components/ui`. These are client entries; the product UI supplies
|
|
94
|
+
its own styled-components theme. Standalone controls use the host's Wikex theme.
|
|
95
|
+
Icons and the default product placeholder are bundled into the package.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import { ProductListing, ProductDetailView, ProductListingSkeleton } from '@enyxs/wikex-components/products';
|
|
99
|
+
|
|
100
|
+
<ProductListing products={items} />
|
|
101
|
+
<ProductDetailView product={detail} related={items} listingHref="/san-pham/" />
|
|
102
|
+
<ProductListingSkeleton language="vi" />
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Each list item supplies `href`; the host owns the API, categories, publication
|
|
106
|
+
rules, SEO and route generation. The detail view accepts introduction, contract
|
|
107
|
+
specifications, quality tables (including per-table columns, units, conditions
|
|
108
|
+
and source notes). Pass `language="en"`, `homeHref`, or `placeholderImage` to
|
|
109
|
+
customize navigation, labels and fallback imagery. Product listing renders and
|
|
110
|
+
paginates the supplied public list; category selection belongs to the host menu; no API is called by this UI.
|
|
111
|
+
Existing CMS demo blocks remain available through the root entry.
|
|
112
|
+
|
|
113
|
+
Run `npm run check`, `npm run build`, and `npm run test:products` before packaging.
|
|
114
|
+
ESM and CommonJS builds preserve client directives and matching styled-components
|
|
115
|
+
IDs for server rendering and hydration.
|
|
116
|
+
|
|
117
|
+
## Fees management UI and shared validation
|
|
118
|
+
|
|
119
|
+
Import `FeesManager` and its prop types from `@enyxs/wikex-components/fees`.
|
|
120
|
+
This controlled screen includes the table selector, language selector, save
|
|
121
|
+
button, notices, row/column counts and the responsive management layout. Supply
|
|
122
|
+
`entries`, `selectedId`, `language`, `table`, `dirtyKeys` (`id:language`),
|
|
123
|
+
`canWrite`, `saving` and the selection/change/save callbacks. The host owns API
|
|
124
|
+
calls, authentication, draft state and navigation warnings. The host may pass
|
|
125
|
+
`statusChipVariant` if its MUI theme supports additional Chip variants.
|
|
126
|
+
|
|
127
|
+
Import pure types, `validateFeesTable`, `defaultFeesTable`, `parseFeesTable`,
|
|
128
|
+
filtering, pagination and ordering helpers from
|
|
129
|
+
`@enyxs/wikex-components/fees/model`. This entry has no React or CMS dependency
|
|
130
|
+
and can run on a backend. Strict validation throws for invalid table data;
|
|
131
|
+
`parseFeesTable` retains public rendering's legacy fallback behavior.
|
|
132
|
+
|
|
133
|
+
## Consultation forms and management
|
|
134
|
+
|
|
135
|
+
The original landing registration renderer accepts `onConsultationSubmit`, an
|
|
136
|
+
async callback receiving `ConsultationSubmission` exported from the root entry.
|
|
137
|
+
It preserves the existing form style, uses MUI selects and shows accessible
|
|
138
|
+
success/error notices. While sending, fields are disabled; failures retain the
|
|
139
|
+
values and submission ID for idempotent retries. Success clears all fields.
|
|
140
|
+
Editable CMS previews do not submit live requests. The host owns the endpoint,
|
|
141
|
+
validation, authentication and storage. The separate partnership form is unchanged.
|
|
142
|
+
|
|
143
|
+
Use `ConsultationManager` from `@enyxs/wikex-components/consultations` for the
|
|
144
|
+
controlled admin table, filters, pagination, detail/status/notes dialog and delete
|
|
145
|
+
confirmation. Supply data, permissions and API callbacks. Pure models and labels
|
|
146
|
+
are exported from `@enyxs/wikex-components/consultations/model`.
|
|
147
|
+
|
|
148
|
+
## Editable Wikex header and footer lists
|
|
149
|
+
|
|
150
|
+
`commodity-header` defines `vi.header.menuItems` and `en.header.menuItems`.
|
|
151
|
+
Each item has `label`, `href`, and a `children` list with its own `label`/`href` items.
|
|
152
|
+
|
|
153
|
+
`commodity-footer` defines these lists in both languages:
|
|
154
|
+
`footer.aboutLinks`, `footer.productLinks`, `footer.guideLinks`,
|
|
155
|
+
`footer.supportLinks`, `footer.contacts`, `footer.socials`, and `footer.downloads`.
|
|
156
|
+
Contact, social, and download items include an `icon`; downloads also have `prefix`.
|
|
157
|
+
Lists and nested lists use JSON strings, following the existing CMS field contract.
|
|
158
|
+
An explicit `[]` removes a list's items.
|
|
159
|
+
|
|
160
|
+
Hosts can import `migrateWikexChromeContent` from
|
|
161
|
+
`@enyxs/wikex-components/chrome/model` before merging defaults or saving content.
|
|
162
|
+
It migrates legacy labels, links, text formatting, and removed items into the lists;
|
|
163
|
+
renderers also apply this migration for older saved pages.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ConsultationSubmission } from './consultation-model.mjs';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
type CmsFieldType = "text" | "textarea" | "richText" | "image" | "link" | "number" | "select" | "list";
|
|
5
|
+
type CmsListItemField = {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
type: "text" | "textarea" | "richText" | "link" | "image" | "list";
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
itemFields?: CmsListItemField[];
|
|
12
|
+
};
|
|
13
|
+
type CmsFieldDefinition = {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
type: CmsFieldType;
|
|
17
|
+
group?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
helperText?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
options?: Array<{
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}>;
|
|
25
|
+
hidden?: boolean;
|
|
26
|
+
itemFields?: CmsListItemField[];
|
|
27
|
+
};
|
|
28
|
+
type CmsComponentCategory = "minimal-ui" | "wikex" | "estate";
|
|
29
|
+
type CmsComponentPlacement = "header" | "content" | "footer";
|
|
30
|
+
type CmsComponentDefinition = {
|
|
31
|
+
kind: "cms-component";
|
|
32
|
+
category: CmsComponentCategory;
|
|
33
|
+
placement?: CmsComponentPlacement;
|
|
34
|
+
hidden?: boolean;
|
|
35
|
+
type: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
icon: string;
|
|
39
|
+
fields: CmsFieldDefinition[];
|
|
40
|
+
defaults: Record<string, string | number>;
|
|
41
|
+
};
|
|
42
|
+
type CmsRendererProps = {
|
|
43
|
+
onConsultationSubmit?: (data: ConsultationSubmission) => Promise<void>;
|
|
44
|
+
content: Record<string, string | number>;
|
|
45
|
+
editable?: boolean;
|
|
46
|
+
readOnlyFields?: string[];
|
|
47
|
+
onChange?: (field: string, value: string) => void;
|
|
48
|
+
onSelectText?: (target: CmsTextTarget) => void;
|
|
49
|
+
selectedTextField?: string;
|
|
50
|
+
onImageRequest?: (field: string, listItem?: {
|
|
51
|
+
index: number;
|
|
52
|
+
key: string;
|
|
53
|
+
}) => void;
|
|
54
|
+
onAddListItem?: () => void;
|
|
55
|
+
};
|
|
56
|
+
type CmsTextTarget = {
|
|
57
|
+
field: string;
|
|
58
|
+
listField?: string;
|
|
59
|
+
itemIndex?: number;
|
|
60
|
+
itemKey?: string;
|
|
61
|
+
nestedListField?: string;
|
|
62
|
+
nestedItemIndex?: number;
|
|
63
|
+
nestedItemKey?: string;
|
|
64
|
+
currentColor?: string;
|
|
65
|
+
};
|
|
66
|
+
type CmsBlock = {
|
|
67
|
+
definition: CmsComponentDefinition;
|
|
68
|
+
Renderer: ComponentType<CmsRendererProps>;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type Content = CmsRendererProps['content'];
|
|
72
|
+
declare function migrateWikexChromeContent(type: string, content: Content): Content;
|
|
73
|
+
|
|
74
|
+
export { type CmsBlock as C, type CmsRendererProps as a, type CmsTextTarget as b, type CmsComponentDefinition as c, type CmsComponentCategory as d, type CmsComponentPlacement as e, type CmsFieldDefinition as f, type CmsFieldType as g, type CmsListItemField as h, migrateWikexChromeContent as m };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ConsultationSubmission } from './consultation-model.js';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
type CmsFieldType = "text" | "textarea" | "richText" | "image" | "link" | "number" | "select" | "list";
|
|
5
|
+
type CmsListItemField = {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
type: "text" | "textarea" | "richText" | "link" | "image" | "list";
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
itemFields?: CmsListItemField[];
|
|
12
|
+
};
|
|
13
|
+
type CmsFieldDefinition = {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
type: CmsFieldType;
|
|
17
|
+
group?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
helperText?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
options?: Array<{
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}>;
|
|
25
|
+
hidden?: boolean;
|
|
26
|
+
itemFields?: CmsListItemField[];
|
|
27
|
+
};
|
|
28
|
+
type CmsComponentCategory = "minimal-ui" | "wikex" | "estate";
|
|
29
|
+
type CmsComponentPlacement = "header" | "content" | "footer";
|
|
30
|
+
type CmsComponentDefinition = {
|
|
31
|
+
kind: "cms-component";
|
|
32
|
+
category: CmsComponentCategory;
|
|
33
|
+
placement?: CmsComponentPlacement;
|
|
34
|
+
hidden?: boolean;
|
|
35
|
+
type: string;
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
icon: string;
|
|
39
|
+
fields: CmsFieldDefinition[];
|
|
40
|
+
defaults: Record<string, string | number>;
|
|
41
|
+
};
|
|
42
|
+
type CmsRendererProps = {
|
|
43
|
+
onConsultationSubmit?: (data: ConsultationSubmission) => Promise<void>;
|
|
44
|
+
content: Record<string, string | number>;
|
|
45
|
+
editable?: boolean;
|
|
46
|
+
readOnlyFields?: string[];
|
|
47
|
+
onChange?: (field: string, value: string) => void;
|
|
48
|
+
onSelectText?: (target: CmsTextTarget) => void;
|
|
49
|
+
selectedTextField?: string;
|
|
50
|
+
onImageRequest?: (field: string, listItem?: {
|
|
51
|
+
index: number;
|
|
52
|
+
key: string;
|
|
53
|
+
}) => void;
|
|
54
|
+
onAddListItem?: () => void;
|
|
55
|
+
};
|
|
56
|
+
type CmsTextTarget = {
|
|
57
|
+
field: string;
|
|
58
|
+
listField?: string;
|
|
59
|
+
itemIndex?: number;
|
|
60
|
+
itemKey?: string;
|
|
61
|
+
nestedListField?: string;
|
|
62
|
+
nestedItemIndex?: number;
|
|
63
|
+
nestedItemKey?: string;
|
|
64
|
+
currentColor?: string;
|
|
65
|
+
};
|
|
66
|
+
type CmsBlock = {
|
|
67
|
+
definition: CmsComponentDefinition;
|
|
68
|
+
Renderer: ComponentType<CmsRendererProps>;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type Content = CmsRendererProps['content'];
|
|
72
|
+
declare function migrateWikexChromeContent(type: string, content: Content): Content;
|
|
73
|
+
|
|
74
|
+
export { type CmsBlock as C, type CmsRendererProps as a, type CmsTextTarget as b, type CmsComponentDefinition as c, type CmsComponentCategory as d, type CmsComponentPlacement as e, type CmsFieldDefinition as f, type CmsFieldType as g, type CmsListItemField as h, migrateWikexChromeContent as m };
|