@fewangsit/wangsvue-gsts 2.0.0-alpha.3 → 2.0.0-alpha.30
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/assets/scanner.worker-DQsz7oT_.js.map +1 -0
- package/badge/Badge.fm.md +32 -0
- package/basetree/index.d.ts +31 -0
- package/breadcrumb/Breadcrumb.fm.md +23 -0
- package/button/Button.fm.md +53 -0
- package/buttonbulkaction/ButtonBulkAction-MenuItem.fm.md +18 -0
- package/buttonbulkaction/ButtonBulkAction.fm.md +25 -0
- package/buttondownload/ButtonDownload.fm.md +22 -0
- package/buttonfilter/ButtonFilter.fm.md +19 -0
- package/buttonscan/index.d.ts +6 -0
- package/buttonsearch/ButtonSearch.fm.md +19 -0
- package/buttonsearchbyscan/ButtonSearchByScan.fm.md +25 -0
- package/buttonselecttree/ButtonSelectTree.fm.md +40 -0
- package/buttonselecttree/index.d.ts +18 -0
- package/calendar/Calendar.fm.md +34 -0
- package/calendar/index.d.ts +41 -0
- package/changelogpage/index.d.ts +1 -1
- package/components.fm.md +56 -0
- package/customcolumn/index.d.ts +5 -5
- package/datatable/DataTable-MenuItem.fm.md +22 -0
- package/datatable/DataTable-TableColumn.fm.md +52 -0
- package/datatable/DataTable.fm.md +40 -0
- package/datatable/index.d.ts +10 -2
- package/dialog/index.d.ts +5 -0
- package/dialogconfirm/DialogConfirm.fm.md +29 -0
- package/dialogconfirm/index.d.ts +1 -0
- package/dialogform/DialogForm.fm.md +57 -0
- package/dialogform/index.d.ts +1 -1
- package/dialogselecttree/DialogSelectTree.fm.md +42 -0
- package/dialogselecttree/index.d.ts +25 -1
- package/dropdown/Dropdown.fm.md +34 -0
- package/fieldwrapper/index.d.ts +5 -0
- package/fileupload/FileUpload.fm.md +31 -0
- package/fileupload/index.d.ts +7 -1
- package/icon/index.d.ts +80 -67
- package/imagecompressor/ImageCompressor.fm.md +44 -0
- package/imagecompressor/index.d.ts +1 -1
- package/inputbadge/InputBadge.fm.md +34 -0
- package/inputbadge/index.d.ts +4 -0
- package/inputcurrency/index.d.ts +14 -0
- package/inputnumber/InputNumber.fm.md +39 -0
- package/inputpassword/InputPassword.fm.md +28 -0
- package/inputpassword/index.d.ts +4 -0
- package/inputphonenumber/InputPhoneNumber.fm.md +34 -0
- package/inputrangenumber/InputRangeNumber.fm.md +31 -0
- package/inputtext/InputText.fm.md +34 -0
- package/mcp/components.json +44 -35
- package/mcp/components.summary.txt +7 -4
- package/mcp/main.js +1276 -1152
- package/mcp/package.json +6 -6
- package/mcp/skills/api-service-generator/SKILL.md +93 -93
- package/mcp/skills/committing-changes/SKILL.md +38 -38
- package/mcp/skills/figma-datatable-generator/SKILL.md +93 -93
- package/mcp/skills/figma-to-code/SKILL.md +118 -117
- package/mcp/skills/import-validator/SKILL.md +54 -54
- package/mcp/skills/wangsvue-code-review/SKILL.md +72 -70
- package/mcp/skills/wangsvue-workflow/SKILL.md +92 -91
- package/menu/index.d.ts +4 -0
- package/multiselect/MultiSelect.fm.md +34 -0
- package/overlaypanel/index.d.ts +4 -0
- package/package.json +1 -1
- package/plugins/WangsVue.d.ts +4 -1
- package/stats.html +1 -1
- package/style.css +2 -2
- package/tabmenu/TabMenu.fm.md +28 -0
- package/tagtype/index.d.ts +1 -1
- package/textarea/TextArea.fm.md +34 -0
- package/toast/index.d.ts +13 -0
- package/tree/index.d.ts +34 -0
- package/utils/baseToast.util.d.ts +1 -24
- package/utils/toast.util.d.ts +1 -3
- package/wangsvue-gsts.es.js +21496 -21174
- package/wangsvue-gsts.es.js.map +1 -1
- package/wangsvue-gsts.system.js +62 -62
- package/wangsvue-gsts.system.js.map +1 -1
- package/assets/scanner.worker-CqQNqzoU.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.worker-DQsz7oT_.js","sources":["../../../library/components/buttonscan/workers/scanner.worker.ts"],"sourcesContent":["interface ConnectionOption {\r\n onopen: (ws: WebSocket, connectionState: ConnectionState) => void;\r\n onmessage: (event: MessageEvent) => void;\r\n onerror: (error: Event) => void;\r\n timeout?: number;\r\n}\r\n\r\ninterface WorkerMessage {\r\n command: string;\r\n sessionId: string;\r\n scanCommand?: string;\r\n userId?: string;\r\n companyCode?: string;\r\n serialNumber?: string;\r\n jenisDevice?: string;\r\n}\r\n\r\ntype ConnectionState = 'established' | 'reused';\r\n\r\nlet socket: WebSocket | null = null;\r\nlet timeoutId: NodeJS.Timeout | null = null; // Stores timeout ID for idle socket connection\r\nlet currentUserId: string | undefined;\r\nlet currentCompanyCode: string | undefined;\r\nlet sessionId: string = ''; // The unique session ID for the current connection\r\n\r\nself.onmessage = (event): void => {\r\n const message: WorkerMessage = event.data;\r\n currentCompanyCode = message.companyCode;\r\n\r\n switch (message.command) {\r\n case 'sync':\r\n sync(message);\r\n break;\r\n case 'connect':\r\n connect(message);\r\n break;\r\n case 'scan':\r\n scan(message);\r\n break;\r\n case 'stopscan':\r\n stopScan(message);\r\n break;\r\n default:\r\n break;\r\n }\r\n};\r\n\r\n/**\r\n * Opens a WebSocket connection if not already open.\r\n * If the connection is open, the `onopen` callback is immediately called.\r\n * @returns {WebSocket} The WebSocket instance.\r\n */\r\nconst openConnection = (opt: ConnectionOption): void => {\r\n let connectionState: ConnectionState = 'established';\r\n if (socket && socket.readyState === WebSocket.OPEN) {\r\n // If the socket is already open, immediately call the onopen callback\r\n connectionState = 'reused';\r\n opt.onopen(socket, connectionState);\r\n resetTimeOut(opt.timeout);\r\n } else {\r\n // If the socket is not open or undefined, create a new connection\r\n socket = new WebSocket(`${import.meta.env.VITE_APP_READER_API}`);\r\n }\r\n\r\n // Handle successful connection\r\n socket.onopen = (): void => {\r\n sessionId =\r\n Math.random().toString(36).substring(2, 15) +\r\n Math.random().toString(36).substring(2, 15); // Generate a random session ID\r\n\r\n connectionState = 'established';\r\n\r\n if (socket) opt.onopen(socket, connectionState); // Execute the onopen callback once the connection is established\r\n resetTimeOut(opt.timeout);\r\n };\r\n\r\n socket.onmessage = (event): void => {\r\n opt.onmessage(event);\r\n resetTimeOut(opt.timeout);\r\n };\r\n\r\n socket.onerror = (error): void => {\r\n console.error('🚀 ~ Scanner Worker: openConnection ~ error:', error);\r\n opt.onerror(error);\r\n socket?.close();\r\n socket = null;\r\n if (timeoutId) clearTimeout(timeoutId);\r\n };\r\n};\r\n\r\nconst handleSocketTimeout = (): void => {\r\n stopScan({ userId: currentUserId });\r\n currentUserId = undefined;\r\n if (socket) socket.close();\r\n socket = null;\r\n if (timeoutId) clearTimeout(timeoutId);\r\n console.info('Socket connection has been closed!');\r\n};\r\n\r\nconst resetTimeOut = (timeout = 0): void => {\r\n if (timeout) {\r\n // Adding this conditional to disable timout, may be sometimes it need to be enable, simpli remove the condition\r\n if (timeoutId) clearTimeout(timeoutId);\r\n timeoutId = setTimeout(handleSocketTimeout, timeout); // Timed out after 3 Minutes\r\n }\r\n};\r\n\r\nconst sync = ({ userId }: WorkerMessage): void => {\r\n currentUserId = userId;\r\n\r\n openConnection({\r\n onopen: (ws: WebSocket): void => {\r\n ws.send(\r\n JSON.stringify({\r\n data: {\r\n command: 'connect',\r\n userId,\r\n sessionId,\r\n companyCode: currentCompanyCode,\r\n source: 'app',\r\n },\r\n event: 'reader',\r\n }),\r\n );\r\n },\r\n\r\n onmessage: (event): void => {\r\n postMessage({ status: 'synced', ...JSON.parse(event.data) });\r\n },\r\n\r\n onerror: (error): void => {\r\n postMessage({ status: 'sync_error', error });\r\n },\r\n });\r\n};\r\n\r\nconst connect = ({ userId }: WorkerMessage): void => {\r\n currentUserId = userId;\r\n\r\n openConnection({\r\n onopen: (ws: WebSocket, state): void => {\r\n if (state === 'established') {\r\n ws.send(\r\n JSON.stringify({\r\n data: {\r\n command: 'connect',\r\n userId,\r\n source: 'app',\r\n sessionId,\r\n companyCode: currentCompanyCode,\r\n },\r\n event: 'reader',\r\n }),\r\n );\r\n } else {\r\n postMessage({\r\n status: 'connection_reused',\r\n });\r\n }\r\n },\r\n\r\n onmessage: (event): void => {\r\n postMessage({\r\n status: 'connection_established',\r\n ...JSON.parse(event.data),\r\n });\r\n },\r\n\r\n onerror: (error): void => {\r\n postMessage({ status: 'error_connecting', error });\r\n },\r\n });\r\n};\r\n\r\nconst scan = ({\r\n scanCommand,\r\n userId,\r\n serialNumber,\r\n jenisDevice,\r\n}: WorkerMessage): void => {\r\n currentUserId = userId;\r\n\r\n openConnection({\r\n onopen: (ws: WebSocket): void => {\r\n ws.send(\r\n JSON.stringify({\r\n data: {\r\n command: scanCommand,\r\n userId,\r\n sessionId,\r\n companyCode: currentCompanyCode,\r\n source: 'app',\r\n serialNumber,\r\n jenisDevice,\r\n },\r\n event: 'reader',\r\n }),\r\n );\r\n\r\n postMessage({ status: 'scan_started' });\r\n },\r\n\r\n onmessage: (event): void => {\r\n postMessage({ status: 'scanned', ...JSON.parse(event.data) });\r\n },\r\n\r\n onerror: (error): void => {\r\n postMessage({ status: 'scan_error', error });\r\n },\r\n });\r\n};\r\n\r\n/**\r\n * Single Scan:\r\n * - Stop Scan will be invoked on socket timeout\r\n *\r\n * Bulk Scan:\r\n * - Stop Scan will also be invoked on stopScan by user interaction\r\n */\r\nconst stopScan = ({ userId }: Partial<WorkerMessage>): void => {\r\n if (socket && socket.readyState === WebSocket.OPEN) {\r\n socket.send(\r\n JSON.stringify({\r\n data: {\r\n command: 'stopscan',\r\n userId,\r\n source: 'app',\r\n sessionId,\r\n companyCode: currentCompanyCode,\r\n },\r\n event: 'reader',\r\n }),\r\n );\r\n\r\n postMessage({ status: 'scan_stopped' });\r\n console.info('Scan Process Stopped!');\r\n }\r\n};\r\n"],"names":["socket","timeoutId","currentUserId","currentCompanyCode","sessionId","event","message","sync","connect","scan","stopScan","openConnection","opt","connectionState","resetTimeOut","error","handleSocketTimeout","timeout","userId","ws","state","scanCommand","serialNumber","jenisDevice"],"mappings":"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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `Badge` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A figma component or instance named "Badge" or similar, consisting of a small rounded pill with centered text (9px SemiBold) and an optional close/remove icon.
|
|
7
|
+
- The Figma `BadgeProps` uses `color` ("Primary" | "Primary Supply" | "Success" | "Warning" | "Dark") and `propDelete` (boolean) to define appearance.
|
|
8
|
+
- IGNORE badges that appear inside an `InputBadge` component (those are child badges, not standalone).
|
|
9
|
+
|
|
10
|
+
## Metadata Shape (Component)
|
|
11
|
+
|
|
12
|
+
Append this component to the `components` array of the returned JSON.
|
|
13
|
+
|
|
14
|
+
## Metadata Shape (Properties)
|
|
15
|
+
|
|
16
|
+
Append these properties to the `props` object of this component.
|
|
17
|
+
|
|
18
|
+
### Properties definitions
|
|
19
|
+
|
|
20
|
+
- `label` (string)
|
|
21
|
+
The text content of the badge. Derived from the text node inside the badge pill element.
|
|
22
|
+
|
|
23
|
+
- `severity` (string | undefined)
|
|
24
|
+
The severity of the badge, inferred from the Figma `color` property:
|
|
25
|
+
- `'primary'` if `color` is "Primary" (blue, `--badge/primary`). Used for labels like "group", "nama".
|
|
26
|
+
- `'success'` if `color` is "Success" (green). Used for status like "verified".
|
|
27
|
+
- `'warning'` if `color` is "Warning" (yellow). Used for status like "unverified".
|
|
28
|
+
- `'dark'` if `color` is "Dark" (dark). Used for labels like "brand", "model type", "disposed".
|
|
29
|
+
- Omit if the color does not match any known mapping.
|
|
30
|
+
|
|
31
|
+
- `removable` (boolean | undefined)
|
|
32
|
+
Whether a close/remove icon button is present inside the badge. Maps to the Figma `propDelete` property. If `propDelete` is true or a close icon exists, set to `true`. Omit if absent.
|
package/basetree/index.d.ts
CHANGED
|
@@ -90,6 +90,15 @@ export interface TreeNode {
|
|
|
90
90
|
* Icon to use in collapsed state.
|
|
91
91
|
*/
|
|
92
92
|
collapsedIcon?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Available quota for fixed assets in this group.
|
|
95
|
+
*/
|
|
96
|
+
fixedAssetQuota?: { available: number };
|
|
97
|
+
/**
|
|
98
|
+
* Number of assets currently on transfer, subtracted from available quota.
|
|
99
|
+
*/
|
|
100
|
+
assetOnTransferCount?: number;
|
|
101
|
+
level?: number;
|
|
93
102
|
/**
|
|
94
103
|
* Optional
|
|
95
104
|
*/
|
|
@@ -453,6 +462,28 @@ export interface BaseTreeProps {
|
|
|
453
462
|
* @return true to disabled
|
|
454
463
|
*/
|
|
455
464
|
nodeSelectedWhen?: (node: TreeNode) => boolean;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* When true, shows available quota count below each group node label.
|
|
468
|
+
* Set programmatically by DialogSelectTree when validateQuota is provided.
|
|
469
|
+
*
|
|
470
|
+
* @default false
|
|
471
|
+
*/
|
|
472
|
+
showAvailableQuota?: boolean;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* When set, nodes whose manager[transactionType] is false will be rendered
|
|
476
|
+
* in a disabled state (data-exact-node-disabled).
|
|
477
|
+
*/
|
|
478
|
+
requiredManagerPermission?: string;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* When true, only top-level nodes (level <= 1) are selectable.
|
|
482
|
+
* Sub-children (level >= 2) are rendered disabled.
|
|
483
|
+
*
|
|
484
|
+
* @default false
|
|
485
|
+
*/
|
|
486
|
+
disableSubChildren?: boolean;
|
|
456
487
|
}
|
|
457
488
|
|
|
458
489
|
/**
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Breadcrumb
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `Breadcrumb` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A figma instance named "Breadcrumb" or similar, unique to a single page.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Component)
|
|
9
|
+
|
|
10
|
+
Append this component to the `components` array of the returned JSON.
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Properties)
|
|
13
|
+
|
|
14
|
+
Append these properties to the `props` object of this component.
|
|
15
|
+
|
|
16
|
+
### Properties definitions
|
|
17
|
+
|
|
18
|
+
- `menus` (BreadcrumbMenu[])
|
|
19
|
+
Get each menu item and set them as follows:
|
|
20
|
+
- `name` (string)
|
|
21
|
+
The label of this item.
|
|
22
|
+
- `route` (string)
|
|
23
|
+
Must be empty.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `Button` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A button named "Button" or similar.
|
|
7
|
+
- The Figma `ButtonProps` uses `type` ("Default" | "Text" | "Outline" | "Icon Default" | "Icon Outline") and `color` ("Primary" | "Success" | "Warning" | "Danger" | "Dark" | "Secondary") to define appearance.
|
|
8
|
+
- IGNORE any already extended button component like "Button Search", "Button Download", etc.
|
|
9
|
+
- IGNORE any action button that is already present in Dialog (such as "Save", "Cancel", "Submit", etc.)
|
|
10
|
+
- IGNORE any action button that is already present in Filter Container (such as "Apply", "Clear Field")
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Component)
|
|
13
|
+
|
|
14
|
+
Append this component to the `components` array of the returned JSON.
|
|
15
|
+
|
|
16
|
+
## Metadata Shape (Properties)
|
|
17
|
+
|
|
18
|
+
Append these properties to the `props` object of this component.
|
|
19
|
+
|
|
20
|
+
### Properties definitions
|
|
21
|
+
|
|
22
|
+
- `label` (string | undefined)
|
|
23
|
+
The text of the button. Derived from the `text` property in Figma. For icon-only buttons (type "Icon Default" or "Icon Outline"), omit this field.
|
|
24
|
+
|
|
25
|
+
- `icon` (WangsIcons | undefined)
|
|
26
|
+
The icon of the button. Derived from the `data-name` attribute of an icon/image node inside the button (e.g. `checkbox-blank-circle-line`, `close-line`, `search-2-line`). If no icon is present, omit this field.
|
|
27
|
+
|
|
28
|
+
- `iconPos` (string | undefined)
|
|
29
|
+
The icon position. Inferred from the Figma `leftIcon`/`rightIcon` boolean flags:
|
|
30
|
+
- `'left'` if only `leftIcon` is true.
|
|
31
|
+
- `'right'` if only `rightIcon` is true.
|
|
32
|
+
- Omit if no icon is present, or if `leftIcon` and `rightIcon` are both false.
|
|
33
|
+
|
|
34
|
+
- `severity` (string)
|
|
35
|
+
The severity of the button, inferred from the Figma `color` property:
|
|
36
|
+
- `'primary'` if `color` is "Primary" (blue, `--button/primary`).
|
|
37
|
+
- `'success'` if `color` is "Success" (green, `--button/success`).
|
|
38
|
+
- `'warning'` if `color` is "Warning" (yellow, `--button/warning`).
|
|
39
|
+
- `'danger'` if `color` is "Danger" (red, `--button/danger`).
|
|
40
|
+
- `'secondary'` if `color` is "Secondary" (gray, `--button/disable`).
|
|
41
|
+
- Omit or use `'contrast'` if `color` is "Dark" (`--button/dark`).
|
|
42
|
+
|
|
43
|
+
- `text` (boolean | undefined)
|
|
44
|
+
Whether the button has no background (text-only style). Set to `true` when Figma `type` is "Text". Omit when `type` is "Default" or "Outline".
|
|
45
|
+
|
|
46
|
+
- `outlined` (boolean | undefined)
|
|
47
|
+
Whether the button has a border but no fill. Set to `true` when Figma `type` is "Outline". Omit when `type` is "Default" or "Text".
|
|
48
|
+
|
|
49
|
+
- `size` ('small' | 'large' | undefined)
|
|
50
|
+
Inferred from the button frame dimensions:
|
|
51
|
+
- `'small'` if the button height is notably smaller (e.g. < 26px).
|
|
52
|
+
- `'large'` if the button height is notably larger (e.g. > 26px).
|
|
53
|
+
- Omit for default 26px height.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# MenuItem
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append each multi action option to the `options` array inside the parent `ButtonBulkAction` props when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- For each distinct multi action option detected from the "Bulk Action" or similar layer(s) adjacent to `BulkAction`.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Properties)
|
|
9
|
+
|
|
10
|
+
### Properties definitions
|
|
11
|
+
|
|
12
|
+
`label` (string)
|
|
13
|
+
The text label rendered on the item.
|
|
14
|
+
|
|
15
|
+
`icon` (string)
|
|
16
|
+
Get the icon label rendered on the item, and search for the most similar type string from the WangsIcons type, and set it as kebab-case (just like how it is in the type).
|
|
17
|
+
|
|
18
|
+
WangsIcons reference: ../icon/Icon.vue.d.ts
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ButtonBulkAction
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `ButtonBulkAction` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A button named "ButtonBulkAction" or similar, adjacent to a `DataTable`.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Component)
|
|
9
|
+
|
|
10
|
+
Append this component to the `components` array of the returned JSON.
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Properties)
|
|
13
|
+
|
|
14
|
+
Append these properties to the `props` object of this component.
|
|
15
|
+
|
|
16
|
+
### Properties definitions
|
|
17
|
+
|
|
18
|
+
- `options` (MenuItem[])
|
|
19
|
+
Refer to ./ButtonBulkAction-MenuItem.fm.md
|
|
20
|
+
|
|
21
|
+
- `tableName` (string)
|
|
22
|
+
Must be exactly the same table name with the adjacent `DataTable` component.
|
|
23
|
+
|
|
24
|
+
- `naming` (string)
|
|
25
|
+
The text that contains "x Data(s) Selected", or similar. In this case, "Data" is the naming.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# ButtonDownload
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `ButtonDownload` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A button named "Button Download" or similar, adjacent to a `DataTable`.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Component)
|
|
9
|
+
|
|
10
|
+
Append this component to the `components` array of the returned JSON.
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Properties)
|
|
13
|
+
|
|
14
|
+
Append these properties to the `props` object of this component.
|
|
15
|
+
|
|
16
|
+
### Properties definitions
|
|
17
|
+
|
|
18
|
+
- `tableName` (string)
|
|
19
|
+
Must be exactly the same table name with the adjacent `DataTable` component.
|
|
20
|
+
|
|
21
|
+
- `fileName` (string)
|
|
22
|
+
Must be empty.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ButtonFilter
|
|
2
|
+
type reference: ./ButtonFilter.vue.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `ButtonFilter` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A button named "Button Filter" or similar, adjacent to a `DataTable`.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Component)
|
|
9
|
+
|
|
10
|
+
Append this component to the `components` array of the returned JSON.
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Properties)
|
|
13
|
+
|
|
14
|
+
Append these properties to the `props` object of this component.
|
|
15
|
+
|
|
16
|
+
### Properties definitions
|
|
17
|
+
|
|
18
|
+
- `tableName` (string)
|
|
19
|
+
Must be exactly the same table name with the adjacent `DataTable` component.
|
package/buttonscan/index.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ButtonSearch
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `ButtonSearch` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A button named "Button Search" or similar, adjacent to a `DataTable`.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Component)
|
|
9
|
+
|
|
10
|
+
Append this component to the `components` array of the returned JSON.
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Properties)
|
|
13
|
+
|
|
14
|
+
Append these properties to the `props` object of this component.
|
|
15
|
+
|
|
16
|
+
### Properties definitions
|
|
17
|
+
|
|
18
|
+
- `tableName` (string)
|
|
19
|
+
Must be exactly the same table name with the adjacent `DataTable` component.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ButtonSearchByScan
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `ButtonSearchByScan` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A button named "Button Search by Scan" or similar, with a `qr-scan-line` icon and label "Search by Scan", adjacent to a `DataTable`.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Component)
|
|
9
|
+
|
|
10
|
+
Append this component to the `components` array of the returned JSON.
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Properties)
|
|
13
|
+
|
|
14
|
+
Append these properties to the `props` object of this component.
|
|
15
|
+
|
|
16
|
+
### Properties definitions
|
|
17
|
+
|
|
18
|
+
- `label` (string)
|
|
19
|
+
The text of the button (e.g. "Search by Scan"), if it already is "Search by Scan", omit it.
|
|
20
|
+
|
|
21
|
+
- `icon` (WangsVueIcons | undefined)
|
|
22
|
+
The icon of the button, typically `qr-scan-line`. If no icon is present, omit this field.
|
|
23
|
+
|
|
24
|
+
- `tableName` (string)
|
|
25
|
+
Must be exactly the same table name as the adjacent `DataTable` component.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# ButtonSelectTree
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `ButtonSelectTree` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A figma component or instance named "Button Select Tree" or similar, consisting of a button trigger that opens a tree selection dialog, optionally paired with a label, required asterisk, and info icon. When values are selected, the button text updates to show the selection count (e.g. "3 group(s) selected").
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Component)
|
|
9
|
+
|
|
10
|
+
Append this component to the `components` array of the returned JSON.
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Properties)
|
|
13
|
+
|
|
14
|
+
Append these properties to the `props` object of this component.
|
|
15
|
+
|
|
16
|
+
### Properties definitions
|
|
17
|
+
|
|
18
|
+
- `fieldLabel` (string)
|
|
19
|
+
The text of the label displayed above the button.
|
|
20
|
+
|
|
21
|
+
- `label` (string | undefined)
|
|
22
|
+
The text of the button (e.g. "Select"). When values are selected, the button text is replaced with the selection count (e.g. "3 group(s) selected"). Omit if the button shows the default label.
|
|
23
|
+
|
|
24
|
+
- `fieldInfo` (string | undefined)
|
|
25
|
+
Whether an info icon (`information-line`) is present next to the label. Omit if absent.
|
|
26
|
+
|
|
27
|
+
- `mandatory` (boolean | undefined)
|
|
28
|
+
Whether a red asterisk `*` is present next to the label. Omit if absent.
|
|
29
|
+
|
|
30
|
+
- `invalid` (boolean | undefined)
|
|
31
|
+
Whether the component shows an error state (red caption text below the button). Omit if not in error state.
|
|
32
|
+
|
|
33
|
+
- `disabled` (boolean | undefined)
|
|
34
|
+
Whether the button shows a disabled state (gray background). Omit if not disabled.
|
|
35
|
+
|
|
36
|
+
- `selectionMode` ('single' | 'checkbox')
|
|
37
|
+
Infer from the button type:
|
|
38
|
+
- `"Default"` type (standard button with text like "Select" or "3 group(s) selected") → `'checkbox'`
|
|
39
|
+
- `"Single Selected"` type (badge with edit and close icons) → `'single'`
|
|
40
|
+
- `"Icon"` type (small icon-only button with `checkbox-blank-circle-line`) → `'checkbox'`
|
|
@@ -2,6 +2,7 @@ import { ShallowRef, Slot } from 'vue';
|
|
|
2
2
|
|
|
3
3
|
import { TreeNode } from '../basetree';
|
|
4
4
|
import { QueryParams, ShortFetchListResponse } from '../datatable';
|
|
5
|
+
import { TransactionType } from '../tree';
|
|
5
6
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers.d';
|
|
6
7
|
|
|
7
8
|
export type KeysModelValue = string[] | number[] | undefined;
|
|
@@ -172,6 +173,23 @@ export interface ButtonSelectTreeProps {
|
|
|
172
173
|
* @default false
|
|
173
174
|
*/
|
|
174
175
|
fetchTreeOnButtonRender?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Disable level 2 and deeper nodes (All > Level 1 > Level 2).
|
|
178
|
+
* Only top-level nodes remain selectable.
|
|
179
|
+
*
|
|
180
|
+
* @default false
|
|
181
|
+
*/
|
|
182
|
+
disableSubChildren?: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Specifies the required manager transaction permission to make a node selectable.
|
|
185
|
+
* If the node's `manager[transaction]` value is false, the node will be rendered in a disabled state.
|
|
186
|
+
*/
|
|
187
|
+
requiredManagerPermission?: TransactionType;
|
|
188
|
+
/**
|
|
189
|
+
* When provided, enables quota validation on select.
|
|
190
|
+
* Also shows available quota count below each group node label automatically.
|
|
191
|
+
*/
|
|
192
|
+
validateQuota?: { assetQuantity: number };
|
|
175
193
|
}
|
|
176
194
|
|
|
177
195
|
export type ButtonSelectTreeEmits = {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Calendar
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append a `Calendar` component when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- A figma component or instance named "Calendar" or similar, consisting of a date input field optionally paired with a label, required asterisk, info icon, and a calendar icon.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Component)
|
|
9
|
+
|
|
10
|
+
Append this component to the `components` array of the returned JSON.
|
|
11
|
+
|
|
12
|
+
## Metadata Shape (Properties)
|
|
13
|
+
|
|
14
|
+
Append these properties to the `props` object of this component.
|
|
15
|
+
|
|
16
|
+
### Properties definitions
|
|
17
|
+
|
|
18
|
+
- `label` (string)
|
|
19
|
+
The text of the label displayed above the date input.
|
|
20
|
+
|
|
21
|
+
- `placeholder` (string | undefined)
|
|
22
|
+
The placeholder text inside the date input (e.g. "Select date"). When a date is selected, the placeholder is replaced with the formatted date (e.g. "22/03/2022"). Omit if no placeholder text is visible.
|
|
23
|
+
|
|
24
|
+
- `mandatory` (boolean | undefined)
|
|
25
|
+
Whether a red asterisk `*` is present next to the label, indicating the field is required. Omit if absent.
|
|
26
|
+
|
|
27
|
+
- `fieldInfo` (string | undefined)
|
|
28
|
+
Whether an info icon (`information-line`) is present next to the label. Omit if absent.
|
|
29
|
+
|
|
30
|
+
- `invalid` (boolean | undefined)
|
|
31
|
+
Whether the date input shows an error state (red border, red caption text). Omit if the field is not in error state.
|
|
32
|
+
|
|
33
|
+
- `disabled` (boolean | undefined)
|
|
34
|
+
Whether the date input shows a disabled state (gray background, gray text). Omit if the field is not disabled.
|
package/calendar/index.d.ts
CHANGED
|
@@ -520,6 +520,47 @@ export interface CalendarProps {
|
|
|
520
520
|
* @requires selectionMode = 'range'
|
|
521
521
|
*/
|
|
522
522
|
exactSelection?: boolean;
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* In range selection mode, if the same date is chosen twice,
|
|
526
|
+
* set whether it should be shown as separate dates ("date 1" - "date 1") or not ("date 1").
|
|
527
|
+
* @default true
|
|
528
|
+
*/
|
|
529
|
+
separateSameDate?: boolean;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Validate value while the overlay is shown. This function is run on clicking the overlay's Apply button.
|
|
533
|
+
*
|
|
534
|
+
* @returns {boolean} - Return true if the value is valid.
|
|
535
|
+
*/
|
|
536
|
+
overlayValidatorFunction?: (
|
|
537
|
+
value?: number | number[],
|
|
538
|
+
) => Promise<boolean> | boolean;
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Set the custom validator message to show on the overlay.
|
|
542
|
+
* Used alongside overlayValidatorFunction.
|
|
543
|
+
*/
|
|
544
|
+
overlayValidatorMessage?: string;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Condition to show the date picker message.
|
|
548
|
+
*
|
|
549
|
+
* @returns {string | undefined} - Return the message to show, or undefined if no message should be shown.
|
|
550
|
+
*/
|
|
551
|
+
datePickerMessageFunction?: (value?: number | number[]) => string | undefined;
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Set a message to be shown below the date picker.
|
|
555
|
+
*/
|
|
556
|
+
datePickerMessage?: string;
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Condition to show the overlay validator message inside the overlay.
|
|
560
|
+
*
|
|
561
|
+
* @default false
|
|
562
|
+
*/
|
|
563
|
+
showOverlayValidatorMessage?: boolean;
|
|
523
564
|
}
|
|
524
565
|
|
|
525
566
|
/**
|
package/changelogpage/index.d.ts
CHANGED
package/components.fm.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Supported Components
|
|
2
|
+
|
|
3
|
+
This document lists every wangsvue component the parser can emit. When the design context contains a UI element matching one of the entries below, produce the corresponding metadata block. If a node does NOT match any entry in this list, SKIP it silently — do NOT emit unrecognised components.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
- When the design context contains **multiple page-level frames** (e.g. "fixed-asset/assets", "fixed-asset/borrow", "fixed-asset/missing/active"), process **ALL of them**. Each frame that contains a recognised component yields its own entry in the output.
|
|
8
|
+
- Nodes that clearly map to **Card, Sidebar, or Navbar** are **skipped** (do not emit metadata for them), but their **child nodes are still processed** — a `DataTable` nested inside a Card frame is still emitted.
|
|
9
|
+
|
|
10
|
+
## Component list
|
|
11
|
+
Each of this component contains {component}.fm.md in their respective directory that will guide you how to parse them.
|
|
12
|
+
|
|
13
|
+
Inside these *.fm.md file, they will give definition type reference for each component. ONLY parse component properties that is strictly defined inside the *.fm.md file, DON'T parse component properties that is listed in the *.d.ts, only use it for a type reference.
|
|
14
|
+
|
|
15
|
+
1. DataTable
|
|
16
|
+
2. ButtonSearch
|
|
17
|
+
3. ButtonFilter
|
|
18
|
+
4. ButtonDownload
|
|
19
|
+
5. FilterContainer
|
|
20
|
+
6. Breadcrumb
|
|
21
|
+
7. DialogForm
|
|
22
|
+
8. InputText
|
|
23
|
+
9. InputNumber
|
|
24
|
+
10. TextArea
|
|
25
|
+
11. Dropdown
|
|
26
|
+
12. MultiSelect
|
|
27
|
+
13. Calendar
|
|
28
|
+
14. InputPhoneNumber
|
|
29
|
+
15. InputBadge
|
|
30
|
+
16. InputRangeNumber
|
|
31
|
+
17. FileUpload
|
|
32
|
+
18. ButtonSelectTree
|
|
33
|
+
19. ImageCompressor
|
|
34
|
+
20. InputPassword
|
|
35
|
+
21. ButtonSearchByScan
|
|
36
|
+
22. DialogSelectTree
|
|
37
|
+
23. Button
|
|
38
|
+
24. Badge
|
|
39
|
+
|
|
40
|
+
## How to identify a component from Figma nodes
|
|
41
|
+
|
|
42
|
+
- Use the node `name`, `type`, and child structure from the design context to decide which wangsvue component it represents.
|
|
43
|
+
- If a node clearly maps to Card, Sidebar, or Navbar -> SKIP the node itself but **continue processing its children** (do not discard content nested inside it).
|
|
44
|
+
- If none of the heuristics match -> SKIP the node entirely. Do NOT invent new component types.
|
|
45
|
+
|
|
46
|
+
## Multi-step context fetching
|
|
47
|
+
|
|
48
|
+
1. **Page structure** — Call `figma_get_design_context` on each page-level frame (e.g. `fixed-asset/borrow`). The returned code reveals the table structure, column header text, and whether a sort icon or ellipsis action column is present.
|
|
49
|
+
2. **Column visibility** — For each table, locate its associated `Column Visibility` frame (positioned near the filter area in the canvas, typically at `x~1197.5` with a y near the page's filter container). Call `figma_get_design_context` on that frame to determine `fixed` and `checkedByDefault` per column. Refer to @docs/figma-parser/datatable-tablecolumn.md#determining-fixed-and-checkedbydefault-from-column-visibility-panels.
|
|
50
|
+
3. **Table Toolbars (ButtonSearch)** — The top-level design context may expose a `Table Toolbars` instance as a collapsed component with no visible children. To determine whether a `Button Search` exists, fetch `figma_get_design_context` on that instance directly. The expanded code will reveal child elements with `data-name="Button Search"` containing a `search-2-line` icon. If present, emit a `ButtonSearch` component linked to the adjacent DataTable's `tableName`.
|
|
51
|
+
|
|
52
|
+
## Output specification
|
|
53
|
+
|
|
54
|
+
The parser MUST return a single JSON object. Refer to the typescript specification at ./wangsvue-metadata.ts
|
|
55
|
+
|
|
56
|
+
Use that file as the authoritative type reference when implementing the parser output.
|
package/customcolumn/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { TableColumn } from '../datatable';
|
|
1
|
+
import { Data, TableColumn } from '../datatable';
|
|
2
2
|
import { ClassComponent } from '../ts-helpers.d';
|
|
3
3
|
|
|
4
4
|
export interface CustomColumnLocaleConfig {
|
|
5
5
|
resetDefaultText: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export type DragableColumn = TableColumn & {
|
|
8
|
+
export type DragableColumn = TableColumn<Data> & {
|
|
9
9
|
order?: number;
|
|
10
10
|
parentHeaderField?: string;
|
|
11
|
-
siblingHeaders?: TableColumn[];
|
|
11
|
+
siblingHeaders?: TableColumn<Data>[];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export interface CustomColumnProps {
|
|
15
15
|
tableId: string;
|
|
16
|
-
defaultColumns: TableColumn[];
|
|
17
|
-
visibleColumns: TableColumn[];
|
|
16
|
+
defaultColumns: TableColumn<Data>[];
|
|
17
|
+
visibleColumns: TableColumn<Data>[];
|
|
18
18
|
/**
|
|
19
19
|
* The maximum column count allowed
|
|
20
20
|
* @default infinity
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# MenuItem
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append each single action option to the `options` array inside the parent `DataTable` props when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- For each distinct single action option detected from the "Single Action" or similar layer(s) adjacent to `DataTable`.
|
|
7
|
+
- IGNORE any option that is "No Option Available" or similar.
|
|
8
|
+
|
|
9
|
+
## Metadata Shape (Properties)
|
|
10
|
+
|
|
11
|
+
### Properties definitions
|
|
12
|
+
|
|
13
|
+
`label` (string)
|
|
14
|
+
The text label rendered on the item.
|
|
15
|
+
|
|
16
|
+
`icon` (string)
|
|
17
|
+
Get the icon label rendered on the item, and search for the most similar type string from the WangsIcons type, and set it as kebab-case (just like how it is in the type).
|
|
18
|
+
|
|
19
|
+
WangsIcons reference: ../icon/Icon.vue.d.ts
|
|
20
|
+
|
|
21
|
+
`command` ((event: MenuItemCommandEvent) => void)
|
|
22
|
+
The action that this menu item triggers when clicked. Must always be set to a no-op function: `() => {}`. But if you can use it for showing dialog, you may set it accordingly.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# TableColumn
|
|
2
|
+
type reference: ./index.d.ts
|
|
3
|
+
|
|
4
|
+
Append each column to the `columns` array inside the parent `DataTable` props when the figma context contains:
|
|
5
|
+
|
|
6
|
+
- For each distinct column detected in the `DataTable` header.
|
|
7
|
+
|
|
8
|
+
## Metadata Shape (Properties)
|
|
9
|
+
|
|
10
|
+
### Properties definitions
|
|
11
|
+
|
|
12
|
+
`header` (string)
|
|
13
|
+
The column header text (TH).
|
|
14
|
+
|
|
15
|
+
`field` (string)
|
|
16
|
+
The column header text, but converted into snake_case.
|
|
17
|
+
|
|
18
|
+
`sortable` (boolean)
|
|
19
|
+
True if the column header have the sort icon, false if not. Image column is always false.
|
|
20
|
+
|
|
21
|
+
`visible` (boolean)
|
|
22
|
+
Must be true.
|
|
23
|
+
|
|
24
|
+
`reorderable` (boolean)
|
|
25
|
+
Must be true.
|
|
26
|
+
|
|
27
|
+
`dragable` (boolean)
|
|
28
|
+
Must be true.
|
|
29
|
+
|
|
30
|
+
`fixed` (boolean)
|
|
31
|
+
True if the checkbox for the column visibility of this column is disabled, false if not.
|
|
32
|
+
|
|
33
|
+
`checkedByDefault` (boolean)
|
|
34
|
+
True if the checkbox for the column visibility of this column is checked, false if not.
|
|
35
|
+
|
|
36
|
+
## GUIDANCE for parsing from Figma
|
|
37
|
+
|
|
38
|
+
- Exclude the first column if it contains checkbox. And exclude the last column if it contains ellipsis.
|
|
39
|
+
- Each column in the Figma table frame maps to ONE TableColumn entry.
|
|
40
|
+
|
|
41
|
+
### Determining `fixed` and `checkedByDefault` from Column Visibility panels
|
|
42
|
+
|
|
43
|
+
Locate the `Column Visibility` frame near the table's filter area (typically positioned at `x=1197.5`, y-aligned with the filter container). Call `figma_get_design_context` on that frame to get its expanded code output. Inside it, inspect each `Column-visibility` child:
|
|
44
|
+
|
|
45
|
+
- The `Column-visibility` instance contains a label `<p>` whose text matches the column header — use this to pair visibility state to the correct column.
|
|
46
|
+
- A "Setup Column" entry exists at the top; skip it.
|
|
47
|
+
- **`fixed`**: determined by the checkbox `<div>` background color token:
|
|
48
|
+
- `bg: option-disable-bg (#b5b3c7)` → greyed out, toggle is disabled → `fixed: true`
|
|
49
|
+
- `bg: button/primary (#0063f7)` → blue, toggle is interactive → `fixed: false`
|
|
50
|
+
- **`checkedByDefault`**: if the `check-line` icon (`<img>` with `data-name="check-line"`) is present inside the checkbox, the column is checked → `checkedByDefault: true`. If absent, the column is unchecked → `checkedByDefault: false`.
|
|
51
|
+
|
|
52
|
+
If the `Column Visibility` frame cannot be fetched (node invalid or not exported), fall back to false.
|