create-erxes 0.1.12 → 0.1.13

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/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { mkdir, readFile, readdir, symlink, writeFile } from "node:fs/promises";
9
9
  import { homedir } from "node:os";
10
10
  import { fileURLToPath } from "node:url";
11
11
  // package.json
12
- var version = "0.1.12";
12
+ var version = "0.1.13";
13
13
  // src/existing-plugins.ts
14
14
  /** The old erxes plugins a new-core plugin can be migrated from (`backend/plugins/<name>_api`). */
15
15
  const OLD_PLUGINS = [
@@ -46,6 +46,13 @@ what erxes-ui already has, and the screen each kind of page copies.
46
46
  checkbox each and its `RecordList.useSelection` hook for the bulk command bar.
47
47
  Give `DisplayMenu` and `useListDisplay` the same `displays`, such as
48
48
  `['list', 'board', 'table']`; the first shows until the member picks another.
49
+ - A display core doesn't have, such as a cards grid or a chart, is the list's
50
+ own entry in those `displays`, an erxes-ui `TListDisplayOption`:
51
+ `[{ key: 'cards', label: t('cards', 'Cards'), icon: IconLayoutGrid }, 'table']`.
52
+ It shows in the Display menu beside the built-in ones and is remembered the
53
+ same way; `useListDisplay` returns `'cards'` and the page draws the cards
54
+ under the same header and bar. A display only some members may see is left
55
+ out of `displays` for the others.
49
56
 
50
57
  ## Filter
51
58
 
@@ -63,10 +70,13 @@ gives it its fields, and `FILTER_FIELDS` in `api/src/modules/items/items.ts` app
63
70
  `compileFilter` from `@erxes/plugin-sdk/filter`, which refuses a path it has
64
71
  no column for.
65
72
  - Never: a search box, toggle buttons ("Mine", "Archived"), status tabs, a
66
- ToggleGroup for table and board, or a row of pickers above the table. Each of
67
- those is a field in the menu or the Display menu.
68
- - Saved views (the tabs core's contacts lists have) are core's lists only;
69
- a plugin list shows the one "All …" tab.
73
+ ToggleGroup for table, board, cards or chart, or a row of pickers above the
74
+ table. Each of those is a field in the menu or an entry in the Display menu.
75
+ - Saved views (the tabs core's contacts lists have) come from the record type:
76
+ `<ViewBar recordType="<plugin>:<thing>" allLabel>` and the same `recordType`
77
+ on `ListFilter`. Core stores the member's views of that list and draws their
78
+ tabs and the filter's save; opening one puts its conditions and search in the
79
+ address, so the API applies it through the `filter` and `search` it already gets.
70
80
 
71
81
  ## Records in core's side panel
72
82
 
@@ -94,7 +104,11 @@ gives it its fields, and `FILTER_FIELDS` in `api/src/modules/items/items.ts` app
94
104
  tab is `PanelSection`s of `PanelField` rows. Never an erxes-ui `Sheet`, a
95
105
  header or tabs of the plugin's own, or a `?item=` param.
96
106
  - Open a record with `useOpenRecord().open({ contentType, contentId })` and a
97
- draft with `openNew(contentType, defaults)`. `detailPath(id)` is a route of
107
+ draft with `openNew(contentType, defaults)`. `tab` opens the record on one of
108
+ its tabs, a `tabs` entry's `value`, `detail` or `activity`:
109
+ `open({ contentType: 'hr:employee', contentId, tab: 'leave' })` from a leave
110
+ list or a dashboard tile. A tab the record lacks opens its default, and
111
+ expanding the panel keeps the tab. `detailPath(id)` is a route of
98
112
  the plugin's that renders `<RecordPage contentType contentId />`
99
113
  (`ui/src/__Pascal__.tsx`): the expanded record.
100
114
  - A plugin whose records belong to customers or companies lists them on those
@@ -21,6 +21,11 @@ and renders `./__id__` (the `__Pascal__` export) under `/__id__/*`.
21
21
  `src/__Pascal__.tsx` passes them to `addPluginStyles`, which adds only the
22
22
  classes web's stylesheet lacks. erxes-ui's design rules hold here too (its
23
23
  `AGENTS.md`, enforced by `vp run check`): no inline styles or raw colours.
24
+ - Charts: add `recharts` to the plugin and draw the chart with it, inside
25
+ erxes-ui's `ChartContainer`: `<BarChart responsive data={rows}>` fills the
26
+ container and follows its size, with no wrapper or fixed size. Its `Tooltip`
27
+ and `Legend` take erxes-ui's `ChartTooltipContent` and `ChartLegendContent`
28
+ as `content`.
24
29
  - The plugin's API goes through `src/orpc.ts`:
25
30
  `useQuery(orpc.items.list.queryOptions(...))`,
26
31
  `useMutation(orpc.items.create.mutationOptions(...))`. Types come from
@@ -46,7 +51,9 @@ and renders `./__id__` (the `__Pascal__` export) under `/__id__/*`.
46
51
  address; `useListFilterParams()` hands them to the list's query, and the API
47
52
  applies them with `@erxes/plugin-sdk/filter`'s `compileFilter`, core's own compiler, on a map
48
53
  of the same paths to columns (`FILTER_FIELDS` in `api/src/modules/items/items.ts`). No search boxes, toggle
49
- tabs or pickers in a row above the table. Give both the record type
54
+ tabs or pickers in a row above the table. Another display (board, cards, a chart) is an
55
+ entry in erxes-ui's `DisplayMenu`, the list's own as a `TListDisplayOption`, read back with
56
+ `useListDisplay`. Give both the record type
50
57
  (`recordType={ITEM_TYPE}`): in erxes the bar then shows the member's saved
51
58
  views as tabs, and the filter offers to save one, as on core's customers.
52
59
  - Records open in core's side panel, like a customer: core draws the panel and
@@ -64,7 +71,8 @@ and renders `./__id__` (the `__Pascal__` export) under `/__id__/*`.
64
71
  with core's `fields.check` before saving. Tiles for core's
65
72
  home dashboard are `CONFIG.dashboardWidgets`: `name`, `title`, `icon`, `preview`,
66
73
  `size` and a `lazy` `component`, which core draws as the tile's body under the
67
- title. Forms are core's
74
+ title. A tile or list that leads to one part of a record opens it on that tab:
75
+ `useOpenRecord().open({ contentType, contentId, tab: 'leave' })`. Forms are core's
68
76
  `PanelFormRow` rows with Cancel and Save at the bottom; nothing saves until
69
77
  Save. Dialogs are for confirmations, not forms.
70
78
  - Something that must outlive a page, such as a softphone during a call, is
@@ -13,7 +13,7 @@
13
13
  "@orpc/tanstack-query": "1.16.2",
14
14
  "@tabler/icons-react": "3.34.0",
15
15
  "@tanstack/react-query": "^5.107.1",
16
- "erxes-ui": "npm:@erxes/ui@4.0.0-v2.16",
16
+ "erxes-ui": "npm:@erxes/ui@4.0.0-v2.17",
17
17
  "jotai": "^3.0.2",
18
18
  "nuqs": "^2.10.3",
19
19
  "react": "19.3.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-erxes",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "private": false,
5
5
  "description": "Create an erxes plugin for the new core, or migrate an old erxes plugin onto it: pnpm create erxes",
6
6
  "license": "MIT",