jmapcloud-ng 1.1.15 → 1.1.17
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/.env.example +14 -2
- package/.storybook/main.ts +39 -0
- package/.storybook/preview.tsx +53 -0
- package/index.html.example +58 -0
- package/package.json +8 -16
- package/public/index.js +190 -1
- package/public/ng-core/index.js +8 -7
- package/stories/NumberInput.stories.tsx +76 -0
- package/stories/RadioGroup.stories.tsx +58 -0
- package/stories/Select.stories.tsx +80 -0
- package/stories/TextField.stories.tsx +58 -0
- package/vite.config.ts +185 -0
- package/vitest.config.ts +20 -0
- package/public/119.bfa9a4b99d83c5c950cd.js +0 -1
- package/public/185.634f2ffec94bfe977216.js +0 -1
- package/public/460.e07d1df5de20ecd37b4d.js +0 -89
- package/public/52.f5e2b640458dea9838d1.js +0 -1
- package/public/540.9cffaf176f3221c8051b.js +0 -1
- package/public/579.5815b1ea7d0fe7de443d.js +0 -101
- package/public/619.eeeadc32d69cb206b2f7.js +0 -1
- package/public/625.92fb52db33bd0c51555c.js +0 -1
- package/public/672.18c77287fb908be1bd6e.js +0 -1
- package/public/931.00ed503def9cbc08ad50.js +0 -1
- package/public/de5f4722562b2b315b48.png +0 -0
- package/public/ng-core/09981dd99649bb6ef1ac.svg +0 -105
- package/public/ng-core/52.14c434f61e513f1ef5da.js +0 -1
- package/public/ng-core/c193d6d1884e572c3b28.png +0 -0
- package/public/ng-core/d0566a872348b35a7296.png +0 -0
- package/public/ng-core/de5f4722562b2b315b48.png +0 -0
- /package/public/{0038a0301d10913ef1a5.png → ARROW.9V9mH5sV.png} +0 -0
- /package/public/{4057c163e11def908a90.svg → JMap-Cloud-Logo.Bqp3iL-5.svg} +0 -0
- /package/public/{6be4a9aff03c67e671d8.woff → barlow-v5-latin-ext_latin-300.BOtJevCE.woff} +0 -0
- /package/public/{62df9be6c862d273e849.ttf → barlow-v5-latin-ext_latin-300.CU1HK-bZ.ttf} +0 -0
- /package/public/{8b70e6d02996d24fbe26.woff2 → barlow-v5-latin-ext_latin-300.DLZg2Aqw.woff2} +0 -0
- /package/public/{e29c61ea7a5baabf5f4e.eot → barlow-v5-latin-ext_latin-300.f3X_qAHv.eot} +0 -0
- /package/public/{67e73a1cc6b8251e3ce1.eot → barlow-v5-latin-ext_latin-300italic.Cq3R63xm.eot} +0 -0
- /package/public/{c3d30fdfede822039221.woff → barlow-v5-latin-ext_latin-300italic.D7H-NYlV.woff} +0 -0
- /package/public/{9cd8b1aa87f79ba5fa0d.ttf → barlow-v5-latin-ext_latin-300italic.IFGWg-1n.ttf} +0 -0
- /package/public/{f8f61d01e9d0e645f832.woff2 → barlow-v5-latin-ext_latin-300italic.egA3zdlg.woff2} +0 -0
- /package/public/{78deb69247b11dfaef82.ttf → barlow-v5-latin-ext_latin-500.C4YXkooW.ttf} +0 -0
- /package/public/{ba7c7a40fbe1f44f9479.woff2 → barlow-v5-latin-ext_latin-500.CD6t94O0.woff2} +0 -0
- /package/public/{e8f262034b5631a64a0b.eot → barlow-v5-latin-ext_latin-500.CxOfqZC2.eot} +0 -0
- /package/public/{777e7e6fe2378aaae24f.woff → barlow-v5-latin-ext_latin-500.CzPrU5vz.woff} +0 -0
- /package/public/{25a7d7975ef0d3ef388a.woff → barlow-v5-latin-ext_latin-500italic.57LLgqjl.woff} +0 -0
- /package/public/{b5165670c231fb850519.ttf → barlow-v5-latin-ext_latin-500italic.B6ytA4Ll.ttf} +0 -0
- /package/public/{661f40a1301ccb4a3902.woff2 → barlow-v5-latin-ext_latin-500italic.BlgFPUrR.woff2} +0 -0
- /package/public/{e2a6ddee443d4e6cf1ed.eot → barlow-v5-latin-ext_latin-500italic.Ckyh_717.eot} +0 -0
- /package/public/{c7d002dea1093108b8de.eot → barlow-v5-latin-ext_latin-700.BRgY-mcC.eot} +0 -0
- /package/public/{fd850adaa0518f36b06d.ttf → barlow-v5-latin-ext_latin-700.Bit82amp.ttf} +0 -0
- /package/public/{ce8277efba6b7e0a2a5c.woff → barlow-v5-latin-ext_latin-700.BpBhuUVz.woff} +0 -0
- /package/public/{d0dd3909312ceba37118.woff2 → barlow-v5-latin-ext_latin-700.DC603mJ6.woff2} +0 -0
- /package/public/{4c795b2381e21dab3d48.woff → barlow-v5-latin-ext_latin-700italic.Ca79JvF0.woff} +0 -0
- /package/public/{285533c63e34641da323.woff2 → barlow-v5-latin-ext_latin-700italic.ClCyBg9U.woff2} +0 -0
- /package/public/{879e91ad82b5b535cf0c.eot → barlow-v5-latin-ext_latin-700italic.D8ZJZUNK.eot} +0 -0
- /package/public/{1ee5ef3f7b69d0e1a043.ttf → barlow-v5-latin-ext_latin-700italic.DqT2IX-q.ttf} +0 -0
- /package/public/{5202701c84b3fa4d7fab.woff2 → barlow-v5-latin-ext_latin-italic.1jYUkYRv.woff2} +0 -0
- /package/public/{20810ee7649dffced61b.ttf → barlow-v5-latin-ext_latin-italic.BEAJKPKF.ttf} +0 -0
- /package/public/{ec1879956d06705c8df1.woff → barlow-v5-latin-ext_latin-italic.BWD2mhUL.woff} +0 -0
- /package/public/{70c5533fa86bfec6a286.eot → barlow-v5-latin-ext_latin-italic.DjOUzQd-.eot} +0 -0
- /package/public/{6d63cfd120fdbf1c4eb9.ttf → barlow-v5-latin-ext_latin-regular.B3onXd7t.ttf} +0 -0
- /package/public/{99a52b75db400feaff73.woff2 → barlow-v5-latin-ext_latin-regular.Ca4dJCbb.woff2} +0 -0
- /package/public/{33701469cd0541b0e782.eot → barlow-v5-latin-ext_latin-regular.D-IiuhnY.eot} +0 -0
- /package/public/{2eda83a40af3d9412dce.woff → barlow-v5-latin-ext_latin-regular.DLT4q60S.woff} +0 -0
- /package/public/{6179310a76747e88c3fb.jpeg → default.Ce_Z_JPs.jpeg} +0 -0
- /package/public/{6230e7c7c8475e869f62.jpeg → jmap.C4V11UP7.jpeg} +0 -0
- /package/public/{ef53d84ef6d55e48e702.png → logo.hwi8NCH2.png} +0 -0
- /package/public/ng-core/{cff684e59ffb052d72cb.woff2 → MaterialIcons-Regular.BjVsc-s9.woff2} +0 -0
- /package/public/ng-core/{83bebaf37c09c7e1c3ee.woff → MaterialIcons-Regular.Bnsxcfr1.woff} +0 -0
- /package/public/ng-core/{5e7382c63da0098d634a.ttf → MaterialIcons-Regular.N21pKt8_.ttf} +0 -0
- /package/public/ng-core/{4674f8ded773cb03e824.eot → MaterialIcons-Regular.rDPjWPoz.eot} +0 -0
- /package/public/ng-core/{6be4a9aff03c67e671d8.woff → barlow-v5-latin-ext_latin-300.BOtJevCE.woff} +0 -0
- /package/public/ng-core/{62df9be6c862d273e849.ttf → barlow-v5-latin-ext_latin-300.CU1HK-bZ.ttf} +0 -0
- /package/public/ng-core/{8b70e6d02996d24fbe26.woff2 → barlow-v5-latin-ext_latin-300.DLZg2Aqw.woff2} +0 -0
- /package/public/ng-core/{e29c61ea7a5baabf5f4e.eot → barlow-v5-latin-ext_latin-300.f3X_qAHv.eot} +0 -0
- /package/public/ng-core/{67e73a1cc6b8251e3ce1.eot → barlow-v5-latin-ext_latin-300italic.Cq3R63xm.eot} +0 -0
- /package/public/ng-core/{c3d30fdfede822039221.woff → barlow-v5-latin-ext_latin-300italic.D7H-NYlV.woff} +0 -0
- /package/public/ng-core/{9cd8b1aa87f79ba5fa0d.ttf → barlow-v5-latin-ext_latin-300italic.IFGWg-1n.ttf} +0 -0
- /package/public/ng-core/{f8f61d01e9d0e645f832.woff2 → barlow-v5-latin-ext_latin-300italic.egA3zdlg.woff2} +0 -0
- /package/public/ng-core/{78deb69247b11dfaef82.ttf → barlow-v5-latin-ext_latin-500.C4YXkooW.ttf} +0 -0
- /package/public/ng-core/{ba7c7a40fbe1f44f9479.woff2 → barlow-v5-latin-ext_latin-500.CD6t94O0.woff2} +0 -0
- /package/public/ng-core/{e8f262034b5631a64a0b.eot → barlow-v5-latin-ext_latin-500.CxOfqZC2.eot} +0 -0
- /package/public/ng-core/{777e7e6fe2378aaae24f.woff → barlow-v5-latin-ext_latin-500.CzPrU5vz.woff} +0 -0
- /package/public/ng-core/{25a7d7975ef0d3ef388a.woff → barlow-v5-latin-ext_latin-500italic.57LLgqjl.woff} +0 -0
- /package/public/ng-core/{b5165670c231fb850519.ttf → barlow-v5-latin-ext_latin-500italic.B6ytA4Ll.ttf} +0 -0
- /package/public/ng-core/{661f40a1301ccb4a3902.woff2 → barlow-v5-latin-ext_latin-500italic.BlgFPUrR.woff2} +0 -0
- /package/public/ng-core/{e2a6ddee443d4e6cf1ed.eot → barlow-v5-latin-ext_latin-500italic.Ckyh_717.eot} +0 -0
- /package/public/ng-core/{c7d002dea1093108b8de.eot → barlow-v5-latin-ext_latin-700.BRgY-mcC.eot} +0 -0
- /package/public/ng-core/{fd850adaa0518f36b06d.ttf → barlow-v5-latin-ext_latin-700.Bit82amp.ttf} +0 -0
- /package/public/ng-core/{ce8277efba6b7e0a2a5c.woff → barlow-v5-latin-ext_latin-700.BpBhuUVz.woff} +0 -0
- /package/public/ng-core/{d0dd3909312ceba37118.woff2 → barlow-v5-latin-ext_latin-700.DC603mJ6.woff2} +0 -0
- /package/public/ng-core/{4c795b2381e21dab3d48.woff → barlow-v5-latin-ext_latin-700italic.Ca79JvF0.woff} +0 -0
- /package/public/ng-core/{285533c63e34641da323.woff2 → barlow-v5-latin-ext_latin-700italic.ClCyBg9U.woff2} +0 -0
- /package/public/ng-core/{879e91ad82b5b535cf0c.eot → barlow-v5-latin-ext_latin-700italic.D8ZJZUNK.eot} +0 -0
- /package/public/ng-core/{1ee5ef3f7b69d0e1a043.ttf → barlow-v5-latin-ext_latin-700italic.DqT2IX-q.ttf} +0 -0
- /package/public/ng-core/{5202701c84b3fa4d7fab.woff2 → barlow-v5-latin-ext_latin-italic.1jYUkYRv.woff2} +0 -0
- /package/public/ng-core/{20810ee7649dffced61b.ttf → barlow-v5-latin-ext_latin-italic.BEAJKPKF.ttf} +0 -0
- /package/public/ng-core/{ec1879956d06705c8df1.woff → barlow-v5-latin-ext_latin-italic.BWD2mhUL.woff} +0 -0
- /package/public/ng-core/{70c5533fa86bfec6a286.eot → barlow-v5-latin-ext_latin-italic.DjOUzQd-.eot} +0 -0
- /package/public/ng-core/{6d63cfd120fdbf1c4eb9.ttf → barlow-v5-latin-ext_latin-regular.B3onXd7t.ttf} +0 -0
- /package/public/ng-core/{99a52b75db400feaff73.woff2 → barlow-v5-latin-ext_latin-regular.Ca4dJCbb.woff2} +0 -0
- /package/public/ng-core/{33701469cd0541b0e782.eot → barlow-v5-latin-ext_latin-regular.D-IiuhnY.eot} +0 -0
- /package/public/ng-core/{2eda83a40af3d9412dce.woff → barlow-v5-latin-ext_latin-regular.DLT4q60S.woff} +0 -0
- /package/public/ng-core/{29807dae6b7e9d8d55ec.ico → favicon_dark.BF6q4K7_.ico} +0 -0
- /package/public/ng-core/{a36ae31b461350c13f48.ico → favicon_light.P7XKPcl8.ico} +0 -0
- /package/public/ng-core/{b520733890c5a5ebd989.gif → loading.BSbPtkHb.gif} +0 -0
- /package/public/ng-core/{ef53d84ef6d55e48e702.png → logo.hwi8NCH2.png} +0 -0
- /package/public/{66686eb78f3c2f6b96e8.png → project-home-page.DE87IrpB.png} +0 -0
- /package/public/{49ffd22e22cb71aab698.jpeg → transitionPageBackground.D8W87_U8.jpeg} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { InputAdornment, TextField, Typography } from "@mui/material"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { useArgs } from "storybook/internal/preview-api"
|
|
4
|
+
import { PrintField } from "@/print/components/PrintComponents"
|
|
5
|
+
|
|
6
|
+
const meta: Meta = {
|
|
7
|
+
title: "Form/NumberInput",
|
|
8
|
+
args: {
|
|
9
|
+
label: "Scale",
|
|
10
|
+
value: 25000,
|
|
11
|
+
min: 100,
|
|
12
|
+
max: 10000000000,
|
|
13
|
+
step: 5000
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
label: { control: "text" },
|
|
17
|
+
value: { control: "number" },
|
|
18
|
+
min: { control: "number" },
|
|
19
|
+
max: { control: "number" },
|
|
20
|
+
step: { control: "number" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj
|
|
26
|
+
|
|
27
|
+
export const Scale: Story = {
|
|
28
|
+
render: () => {
|
|
29
|
+
const [{ label, value, min, max, step }, updateArgs] = useArgs<{ label: string; value: number; min: number; max: number; step: number }>()
|
|
30
|
+
return (
|
|
31
|
+
<PrintField label={label}>
|
|
32
|
+
<TextField
|
|
33
|
+
variant="filled"
|
|
34
|
+
type="number"
|
|
35
|
+
value={value}
|
|
36
|
+
onChange={e => updateArgs({ value: Number(e.target.value) })}
|
|
37
|
+
sx={{ "& input": { paddingLeft: 0 } }}
|
|
38
|
+
InputProps={{
|
|
39
|
+
startAdornment: (
|
|
40
|
+
<InputAdornment position="start">
|
|
41
|
+
<Typography sx={theme => ({ paddingLeft: ".9375rem", color: theme.palette.primary.main, fontSize: ".875rem" })}>
|
|
42
|
+
1 :{" "}
|
|
43
|
+
</Typography>
|
|
44
|
+
</InputAdornment>
|
|
45
|
+
),
|
|
46
|
+
inputProps: { min, max, step }
|
|
47
|
+
}}
|
|
48
|
+
/>
|
|
49
|
+
</PrintField>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const Plain: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
label: "Count",
|
|
57
|
+
value: 10,
|
|
58
|
+
min: 0,
|
|
59
|
+
max: 100,
|
|
60
|
+
step: 1
|
|
61
|
+
},
|
|
62
|
+
render: () => {
|
|
63
|
+
const [{ label, value, min, max, step }, updateArgs] = useArgs<{ label: string; value: number; min: number; max: number; step: number }>()
|
|
64
|
+
return (
|
|
65
|
+
<PrintField label={label}>
|
|
66
|
+
<TextField
|
|
67
|
+
variant="filled"
|
|
68
|
+
type="number"
|
|
69
|
+
value={value}
|
|
70
|
+
onChange={e => updateArgs({ value: Number(e.target.value) })}
|
|
71
|
+
InputProps={{ inputProps: { min, max, step } }}
|
|
72
|
+
/>
|
|
73
|
+
</PrintField>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Checkbox, FormControlLabel, FormGroup, FormLabel } from "@mui/material"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { useArgs } from "storybook/internal/preview-api"
|
|
4
|
+
import { RadioGroup } from "@/print/components/PrintComponents"
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof RadioGroup> = {
|
|
7
|
+
title: "Form/RadioGroup",
|
|
8
|
+
component: RadioGroup
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof RadioGroup>
|
|
13
|
+
|
|
14
|
+
export const MultipleCheckboxes: Story = {
|
|
15
|
+
render: () => {
|
|
16
|
+
const [args, updateArgs] = useArgs<{ date: boolean; north: boolean; scale: boolean; legend: boolean }>()
|
|
17
|
+
return (
|
|
18
|
+
<RadioGroup>
|
|
19
|
+
<FormLabel component="legend">Display</FormLabel>
|
|
20
|
+
<FormGroup>
|
|
21
|
+
<FormControlLabel
|
|
22
|
+
control={<Checkbox size="small" color="primary" checked={args.date ?? true} onChange={() => updateArgs({ date: !args.date })} />}
|
|
23
|
+
label="Date"
|
|
24
|
+
/>
|
|
25
|
+
<FormControlLabel
|
|
26
|
+
control={<Checkbox size="small" color="primary" checked={args.north ?? true} onChange={() => updateArgs({ north: !args.north })} />}
|
|
27
|
+
label="North Arrow"
|
|
28
|
+
/>
|
|
29
|
+
<FormControlLabel
|
|
30
|
+
control={<Checkbox size="small" color="primary" checked={args.scale ?? true} onChange={() => updateArgs({ scale: !args.scale })} />}
|
|
31
|
+
label="Scale"
|
|
32
|
+
/>
|
|
33
|
+
<FormControlLabel
|
|
34
|
+
control={<Checkbox size="small" color="primary" checked={args.legend ?? false} onChange={() => updateArgs({ legend: !args.legend })} />}
|
|
35
|
+
label="Legend"
|
|
36
|
+
/>
|
|
37
|
+
</FormGroup>
|
|
38
|
+
</RadioGroup>
|
|
39
|
+
)
|
|
40
|
+
},
|
|
41
|
+
args: { date: true, north: true, scale: true, legend: false } as any
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const SingleCheckbox: Story = {
|
|
45
|
+
render: () => {
|
|
46
|
+
const [{ checked }, updateArgs] = useArgs<{ checked: boolean }>()
|
|
47
|
+
return (
|
|
48
|
+
<RadioGroup>
|
|
49
|
+
<FormLabel component="legend">Resolution</FormLabel>
|
|
50
|
+
<FormControlLabel
|
|
51
|
+
control={<Checkbox size="small" color="primary" checked={checked ?? false} onChange={() => updateArgs({ checked: !checked })} />}
|
|
52
|
+
label="High resolution"
|
|
53
|
+
/>
|
|
54
|
+
</RadioGroup>
|
|
55
|
+
)
|
|
56
|
+
},
|
|
57
|
+
args: { checked: false } as any
|
|
58
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Select } from "@mui/material"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { useArgs } from "storybook/internal/preview-api"
|
|
4
|
+
import { PrintField } from "@/print/components/PrintComponents"
|
|
5
|
+
|
|
6
|
+
const meta: Meta = {
|
|
7
|
+
title: "Form/Select",
|
|
8
|
+
args: {
|
|
9
|
+
label: "File Type",
|
|
10
|
+
value: "png"
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
label: { control: "text" },
|
|
14
|
+
value: { control: "select", options: ["png", "jpeg", "pdf"] }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj
|
|
20
|
+
|
|
21
|
+
export const FileType: Story = {
|
|
22
|
+
render: () => {
|
|
23
|
+
const [{ label, value }, updateArgs] = useArgs<{ label: string; value: string }>()
|
|
24
|
+
return (
|
|
25
|
+
<PrintField label={label}>
|
|
26
|
+
<Select native variant="filled" value={value} onChange={e => updateArgs({ value: e.target.value })}>
|
|
27
|
+
<option value="png">png</option>
|
|
28
|
+
<option value="jpeg">jpeg</option>
|
|
29
|
+
<option value="pdf">pdf</option>
|
|
30
|
+
</Select>
|
|
31
|
+
</PrintField>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const PaperFormat: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
label: "Paper Format",
|
|
39
|
+
value: "letter"
|
|
40
|
+
},
|
|
41
|
+
argTypes: {
|
|
42
|
+
value: { control: "select", options: ["letter", "a4", "a3", "a2", "a1", "a0"] }
|
|
43
|
+
},
|
|
44
|
+
render: () => {
|
|
45
|
+
const [{ label, value }, updateArgs] = useArgs<{ label: string; value: string }>()
|
|
46
|
+
return (
|
|
47
|
+
<PrintField label={label}>
|
|
48
|
+
<Select native variant="filled" value={value} onChange={e => updateArgs({ value: e.target.value })}>
|
|
49
|
+
<option value="letter">Letter</option>
|
|
50
|
+
<option value="a4">A4</option>
|
|
51
|
+
<option value="a3">A3</option>
|
|
52
|
+
<option value="a2">A2</option>
|
|
53
|
+
<option value="a1">A1</option>
|
|
54
|
+
<option value="a0">A0</option>
|
|
55
|
+
</Select>
|
|
56
|
+
</PrintField>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const Orientation: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
label: "Orientation",
|
|
64
|
+
value: "true"
|
|
65
|
+
},
|
|
66
|
+
argTypes: {
|
|
67
|
+
value: { control: "select", options: ["true", "false"] }
|
|
68
|
+
},
|
|
69
|
+
render: () => {
|
|
70
|
+
const [{ label, value }, updateArgs] = useArgs<{ label: string; value: string }>()
|
|
71
|
+
return (
|
|
72
|
+
<PrintField label={label}>
|
|
73
|
+
<Select native variant="filled" value={value} onChange={e => updateArgs({ value: e.target.value })}>
|
|
74
|
+
<option value="true">Portrait</option>
|
|
75
|
+
<option value="false">Landscape</option>
|
|
76
|
+
</Select>
|
|
77
|
+
</PrintField>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { TextField } from "@mui/material"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { useArgs } from "storybook/internal/preview-api"
|
|
4
|
+
import { PrintField } from "@/print/components/PrintComponents"
|
|
5
|
+
|
|
6
|
+
const meta: Meta = {
|
|
7
|
+
title: "Form/TextField",
|
|
8
|
+
args: {
|
|
9
|
+
label: "Title",
|
|
10
|
+
value: "My Map Title",
|
|
11
|
+
placeholder: ""
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
label: { control: "text" },
|
|
15
|
+
value: { control: "text" },
|
|
16
|
+
placeholder: { control: "text" }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {
|
|
24
|
+
render: () => {
|
|
25
|
+
const [{ label, value, placeholder }, updateArgs] = useArgs<{ label: string; value: string; placeholder: string }>()
|
|
26
|
+
return (
|
|
27
|
+
<PrintField label={label}>
|
|
28
|
+
<TextField
|
|
29
|
+
variant="filled"
|
|
30
|
+
value={value}
|
|
31
|
+
placeholder={placeholder}
|
|
32
|
+
onChange={e => updateArgs({ value: e.target.value })}
|
|
33
|
+
/>
|
|
34
|
+
</PrintField>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Empty: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
label: "Subtitle",
|
|
42
|
+
value: "",
|
|
43
|
+
placeholder: "Enter subtitle..."
|
|
44
|
+
},
|
|
45
|
+
render: () => {
|
|
46
|
+
const [{ label, value, placeholder }, updateArgs] = useArgs<{ label: string; value: string; placeholder: string }>()
|
|
47
|
+
return (
|
|
48
|
+
<PrintField label={label}>
|
|
49
|
+
<TextField
|
|
50
|
+
variant="filled"
|
|
51
|
+
value={value}
|
|
52
|
+
placeholder={placeholder}
|
|
53
|
+
onChange={e => updateArgs({ value: e.target.value })}
|
|
54
|
+
/>
|
|
55
|
+
</PrintField>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import react from "@vitejs/plugin-react"
|
|
2
|
+
import dotenv from "dotenv"
|
|
3
|
+
import { readFileSync } from "fs"
|
|
4
|
+
import { resolve } from "path"
|
|
5
|
+
import { defineConfig, type Plugin } from "vite"
|
|
6
|
+
import mkcert from "vite-plugin-mkcert"
|
|
7
|
+
|
|
8
|
+
dotenv.config({ path: resolve(__dirname, ".env") })
|
|
9
|
+
|
|
10
|
+
const packageJSON = JSON.parse(readFileSync(resolve(__dirname, "package.json"), "utf8"))
|
|
11
|
+
|
|
12
|
+
const getBuildNumber = () => {
|
|
13
|
+
const d = new Date()
|
|
14
|
+
const pad = (n: number) => (n < 10 ? `0${n}` : `${n}`)
|
|
15
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}.${process.env.GITHUB_BUILD_NUMBER ?? "dev"}`
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const getRestBaseUrl = () => {
|
|
19
|
+
const env = process.env.CLOUD_ENV
|
|
20
|
+
const prefix =
|
|
21
|
+
env === "production" ? "" : env === "staging" ? "staging." : env === "QA" ? "qa." : process.env.REST_BASE_API_DEV_SERVER_PREFIX ? `${process.env.REST_BASE_API_DEV_SERVER_PREFIX}.` : "dev."
|
|
22
|
+
return `https://api.${prefix}jmapcloud.io`
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const getHtmlInputPath = () => resolve(__dirname, process.env.BUILD_TARGET === "cloud" ? "build/index.html" : "index.html")
|
|
26
|
+
|
|
27
|
+
const JMAP_OPTIONS_PLACEHOLDER = "/* __JMAP_OPTIONS_PLACEHOLDER__ */"
|
|
28
|
+
|
|
29
|
+
function jmapOptionsPlugin(): Plugin {
|
|
30
|
+
return {
|
|
31
|
+
name: "jmap-options",
|
|
32
|
+
transformIndexHtml(html: string) {
|
|
33
|
+
const replacement = `window.JMAP_OPTIONS = { restBaseUrl: "${getRestBaseUrl()}", map: {}, application: {}, hideMainLayout: true }`
|
|
34
|
+
return html.replace(JMAP_OPTIONS_PLACEHOLDER, replacement)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function inlineCssInLegacyBuildPlugin(isLegacyProductionBuild: boolean): Plugin {
|
|
40
|
+
return {
|
|
41
|
+
name: "inline-css-in-legacy-build",
|
|
42
|
+
apply: "build",
|
|
43
|
+
enforce: "post",
|
|
44
|
+
generateBundle(_outputOptions, bundle) {
|
|
45
|
+
if (!isLegacyProductionBuild) {
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const cssAssets = Object.entries(bundle).flatMap(([fileName, output]) => {
|
|
50
|
+
if (output.type !== "asset" || !output.fileName.endsWith(".css")) {
|
|
51
|
+
return []
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const source = output.source
|
|
55
|
+
const cssText = typeof source === "string" ? source : Buffer.from(source).toString("utf8")
|
|
56
|
+
return [{ fileName, cssText }]
|
|
57
|
+
})
|
|
58
|
+
const combinedCss = cssAssets.map(css => css.cssText).join("\n")
|
|
59
|
+
|
|
60
|
+
for (const output of Object.values(bundle)) {
|
|
61
|
+
if (output.type !== "chunk" || !output.isEntry) {
|
|
62
|
+
continue
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!combinedCss) {
|
|
66
|
+
continue
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const packageStyleNamespace = packageJSON.name.replace(/[^a-zA-Z0-9_-]/g, "-")
|
|
70
|
+
const styleId = `vite-inline-css-${packageStyleNamespace}-${output.fileName.replace(/[^a-zA-Z0-9_-]/g, "-")}`
|
|
71
|
+
const injectionCode = `(function(){var id=${JSON.stringify(styleId)};if(document.getElementById(id)){return;}var s=document.createElement("style");s.id=id;s.appendChild(document.createTextNode(${JSON.stringify(combinedCss)}));document.head.appendChild(s);}());`
|
|
72
|
+
output.code = `${injectionCode}\n${output.code}`
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
for (const css of cssAssets) {
|
|
76
|
+
const cssFileName = css.fileName
|
|
77
|
+
delete bundle[cssFileName]
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
for (const output of Object.values(bundle)) {
|
|
81
|
+
if (output.type !== "asset" || !output.fileName.endsWith(".html")) {
|
|
82
|
+
continue
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const source = output.source
|
|
86
|
+
const html = typeof source === "string" ? source : Buffer.from(source).toString("utf8")
|
|
87
|
+
|
|
88
|
+
output.source = html
|
|
89
|
+
.replace(/<link[^>]*rel=["']stylesheet["'][^>]*>\s*/g, "")
|
|
90
|
+
// Legacy mode uses classic scripts; strip module type first.
|
|
91
|
+
.replace(/<script([^>]*?)\stype=["']module["']([^>]*)>/g, (_match: string, before: string, after: string) => `<script${before}${after}>`)
|
|
92
|
+
// Enforce defer on every script tag in legacy HTML.
|
|
93
|
+
.replace(/<script(?![^>]*\bdefer\b)([^>]*)>/g, (_match: string, attrs: string) => `<script${attrs} defer>`)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
export default defineConfig(async ({ command }): Promise<any> => {
|
|
101
|
+
const postcssParentSelector = (await import("postcss-parent-selector")).default
|
|
102
|
+
const keepGlobalRootSelectorsPlugin: any = {
|
|
103
|
+
postcssPlugin: "keep-global-root-selectors",
|
|
104
|
+
Rule(rule: { selectors?: string[] }) {
|
|
105
|
+
if (!rule.selectors) {
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
rule.selectors = rule.selectors.map(selector => selector.replace(/^\.jmap_wrapper\s+(html|body|:root)(?=[\s.:#[>+~]|$)/, "$1"))
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const isLegacyProductionBuild = command === "build" && process.env.NODE_ENV === "production"
|
|
112
|
+
const coreIndexFileUrl =
|
|
113
|
+
process.env.CORE_INDEX_FILE_URL && process.env.CORE_INDEX_FILE_URL.trim().length > 0
|
|
114
|
+
? process.env.CORE_INDEX_FILE_URL
|
|
115
|
+
: command === "serve"
|
|
116
|
+
? `https://localhost:${process.env.CORE_DEV_PORT ?? "8085"}/src/core.ts`
|
|
117
|
+
: "./ng-core/index.js"
|
|
118
|
+
const plugins: any[] = [react(), jmapOptionsPlugin(), inlineCssInLegacyBuildPlugin(isLegacyProductionBuild)]
|
|
119
|
+
|
|
120
|
+
if (command === "serve") {
|
|
121
|
+
const { default: checker } = await import("vite-plugin-checker")
|
|
122
|
+
plugins.push(mkcert(), checker({ typescript: true }))
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
root: __dirname,
|
|
127
|
+
resolve: {
|
|
128
|
+
alias: {
|
|
129
|
+
"@": resolve(__dirname, "src")
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
define: {
|
|
133
|
+
TYPESCRIPT_APP_VERSION: JSON.stringify(getBuildNumber()),
|
|
134
|
+
APP_VERSION: process.env.BUILD_TARGET === "cloud" ? JSON.stringify(getBuildNumber()) : JSON.stringify(packageJSON.version),
|
|
135
|
+
IS_DEV: command === "serve" ? "true" : "false",
|
|
136
|
+
CORE_INDEX_FILE_URL: JSON.stringify(coreIndexFileUrl),
|
|
137
|
+
MUI_X_PRO_LICENSE: JSON.stringify(process.env.MUI_X_PRO_LICENSE ?? "")
|
|
138
|
+
},
|
|
139
|
+
css: {
|
|
140
|
+
postcss: {
|
|
141
|
+
plugins: [
|
|
142
|
+
postcssParentSelector({
|
|
143
|
+
selector: ".jmap_wrapper"
|
|
144
|
+
}),
|
|
145
|
+
keepGlobalRootSelectorsPlugin
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
plugins,
|
|
150
|
+
server: {
|
|
151
|
+
port: Number(process.env.DEV_PORT) || 8086,
|
|
152
|
+
cors: true
|
|
153
|
+
},
|
|
154
|
+
build: {
|
|
155
|
+
outDir: process.env.BUILD_DIR || resolve(__dirname, "public"),
|
|
156
|
+
emptyOutDir: true,
|
|
157
|
+
target: isLegacyProductionBuild ? "es2015" : "esnext",
|
|
158
|
+
sourcemap: command === "serve",
|
|
159
|
+
cssCodeSplit: !isLegacyProductionBuild,
|
|
160
|
+
// TODO: feature/JMAP8-3471 - replace terser by esbuild
|
|
161
|
+
minify: "terser",
|
|
162
|
+
terserOptions: {
|
|
163
|
+
compress: {},
|
|
164
|
+
ecma: 2015,
|
|
165
|
+
keep_classnames: true,
|
|
166
|
+
keep_fnames: true,
|
|
167
|
+
toplevel: false,
|
|
168
|
+
format: {
|
|
169
|
+
comments: false,
|
|
170
|
+
beautify: false
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
rollupOptions: {
|
|
174
|
+
input: getHtmlInputPath(),
|
|
175
|
+
output: {
|
|
176
|
+
...(isLegacyProductionBuild ? { format: "iife" as const, name: "JMapNgBundle" } : {}),
|
|
177
|
+
inlineDynamicImports: isLegacyProductionBuild,
|
|
178
|
+
entryFileNames: process.env.BUILD_TARGET === "cloud" ? "[name].[hash].js" : "[name].js",
|
|
179
|
+
chunkFileNames: "[name].[hash].js",
|
|
180
|
+
assetFileNames: "[name].[hash][extname]"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
})
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="vitest/config" />
|
|
2
|
+
import { resolve } from "path"
|
|
3
|
+
import { defineConfig } from "vitest/config"
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
resolve: {
|
|
7
|
+
alias: {
|
|
8
|
+
"@": resolve(__dirname, "src"),
|
|
9
|
+
"jmapcloud-common": resolve(__dirname, "../../../packages/jmapcloud-common/src/index.ts"),
|
|
10
|
+
"jmapcloud-ng-core-types": resolve(__dirname, "../ng-core-types/index.ts"),
|
|
11
|
+
"jmapcloud-ng-types": resolve(__dirname, "../ng-types/index.ts"),
|
|
12
|
+
"jmapcloud-ng-types/all-enums": resolve(__dirname, "../ng-types/all-enums.ts")
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
test: {
|
|
16
|
+
environment: "node",
|
|
17
|
+
globals: true,
|
|
18
|
+
passWithNoTests: true
|
|
19
|
+
}
|
|
20
|
+
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkjmapcloud_ng=self.webpackChunkjmapcloud_ng||[]).push([[119],{90119:function(e,t,n){n.r(t),n.d(t,{startSelectionPage:function(){return startSelectionPage}});var i=n(49236),a=n(36870),l=n(86326),r=n(63776),o=n(61275),s=n(68737),d=n(82432),c=(n(80742),n(8380),n(1986),n(47531)),h=n(91829),u=n(15331),b=n(31665),p=n(5535),m=n(51682),g=n(92248),A=n(9940),f=n(12945),x=n(73726),C=n(12396),S=n(42432),j=n(63010),v=n(63641),y=n(76922),N=n(72387),T=n(69626),w=n(13326),_=n(65492);const D=(0,w.Ay)(_.A)({height:"1rem",borderRadius:"0.1rem",fontSize:"0.8rem","& > .MuiChip-label":{textAlign:"center",padding:"0.2rem",paddingLeft:"0.25rem",paddingRight:"0.25rem"}},{withTheme:!0});var E=n(67110),P=void 0;const k=function getCollator(){return(0,i.A)(this,P),new Intl.Collator(JMap.Language.getLocale(),{numeric:!0,sensitivity:"base"})}.bind(void 0),M=function compare(e,t,n,a){return(0,i.A)(this,P),null==e&&null!=t?a===E.C_.ASCENDANT?1:-1:null!=e&&null==t?a===E.C_.ASCENDANT?-1:1:a===E.C_.ASCENDANT?n.compare(e,t):n.compare(t,e)}.bind(void 0);var R=n(82324),L=n(64821);function EnhancedTableHead(e){var t=this;const{order:n,orderBy:l,onRequestSort:r}=e,o=function createSortHandler(e){var n=this;return(0,i.A)(this,t),function(t){(0,i.A)(this,n),r(t,e)}.bind(this)}.bind(this);return(0,a.jsx)(f.A,{children:(0,a.jsx)(C.A,{children:e.headCells.map(function(e){return(0,i.A)(this,t),(0,a.jsx)(g.A,{id:`selection-table-header-${e.id}`,align:"left",padding:e.disablePadding?"none":"normal",sortDirection:l===e.name&&n,children:(0,a.jsxs)(S.A,{id:`selection-table-header-${e.id}-label`,sx:{textTransform:"capitalize"},active:l===e.name,direction:l===e.name?n:E.C_.ASCENDANT,onClick:o(e.name),children:[e.label,l===e.name?(0,a.jsx)(u.A,{component:"span",sx:{border:0,clip:"rect(0 0 0 0)",height:1,margin:-1,overflow:"hidden",padding:0,position:"absolute",top:20,width:1},children:n===E.C_.DESCENDANT?"sorted descending":"sorted ascending"}):null]})},e.id)}.bind(this))})})}const I=(0,d.Ng)(function(e){var t=this;(0,i.A)(this,undefined);const n=(0,N.B)(e).selection.displayedLayerId,a=e.layer.allById[n],l=a?a.attributes:[],r=a?a.name:"-";return{selection:e.map.selection,displayedLayerId:n,layerName:r,headCells:l.map(function(e){return(0,i.A)(this,t),{id:e.id,name:e.name,disablePadding:!0,label:e.label,type:e.type}}.bind(this)),containerHeight:e.map.containerHeight}}.bind(void 0))(function SelectionTableFn(e){var t=this;const[n,r]=l.useState(E.C_.ASCENDANT),[o,d]=l.useState(""),[f,S]=l.useState(0),N=function handleRequestSort(e,a){(0,i.A)(this,t);const l=o===a&&n===E.C_.ASCENDANT;r(l?E.C_.DESCENDANT:E.C_.ASCENDANT),d(a)}.bind(this),w=function handleClick(e,n){(0,i.A)(this,t),JMap.Map.fitFeatures([n.jmap_feature_buff],{paddingBottom:(0,L.N)(),maxZoom:R.nD})}.bind(this),_=function handlePageChange(e,n){return(0,i.A)(this,t),S(n)}.bind(this),P=(e.selection[e.displayedLayerId]||[]).map(function(e){return(0,i.A)(this,t),{jmap_feature_buff:e,...e.properties}}.bind(this));let I=f;f*T.l>P.length&&(I=0);const H=k();return(0,a.jsxs)(u.A,{sx:function sx(e){return(0,i.A)(this,t),{backgroundColor:e.palette.background.paper,width:"100%",height:"100%",paddingLeft:".5rem",paddingRight:".5rem",borderRadius:0}}.bind(this),children:[(0,a.jsx)(b.A,{id:"selection-table-close-button",title:(0,y.Tl)("selection.close.table"),children:(0,a.jsx)(u.A,{sx:{position:"absolute",top:".5rem",right:".5rem",zIndex:2,cursor:"pointer"},children:(0,a.jsx)(h.gc,{icon:c.GR,onClick:function onClick(){(0,i.A)(this,t),JMap.Application.Selection.closeTableTab()}.bind(this)})})}),(0,a.jsxs)(j.A,{sx:{position:"relative",left:"0.5rem"},children:[(0,a.jsx)(v.A,{id:"selection-table-layer-title",variant:"h6",color:"textPrimary",children:e.layerName}),(0,a.jsxs)(v.A,{id:"selection-table-count-title",sx:{fontSize:".95rem"},color:"textSecondary",children:[" : ",(0,y.Tl)("selection.layer.count",P.length)]})]}),(0,a.jsx)(A.A,{sx:{position:"relative",left:"0.5rem",width:"calc(100% - 1rem)",overflowY:"auto",overflowX:"auto",height:"calc(100% - 4rem)"},children:(0,a.jsxs)(p.A,{"aria-labelledby":"selection-table-title",size:"small","aria-label":"Selection table",children:[(0,a.jsx)(EnhancedTableHead,{headCells:e.headCells,order:n,orderBy:o,onRequestSort:N}),(0,a.jsx)(m.A,{children:P.sort(function(e,a){return(0,i.A)(this,t),M(e[o],a[o],H,n)}.bind(this)).slice(I*T.l,I*T.l+T.l).map(function(n,l){var r=this;return(0,i.A)(this,t),(0,a.jsx)(C.A,{id:`selection-table-row-${l}`,hover:!0,onClick:function onClick(e){return(0,i.A)(this,r),w(e,n)}.bind(this),tabIndex:-1,children:e.headCells.map(function(e,t){return(0,i.A)(this,r),(0,a.jsx)(g.A,{id:`selection-table-row-${l}-cell-${e.id}`,align:"number"===e.type?"right":"left",children:(o=e.type,d=n[e.name],null==d||"null"===d?(0,a.jsx)(D,{variant:"filled",color:"secondary",label:(0,y.Tl)(`data.${String(d)}`)}):"date"===o||"datetime"===o?JMap.Util.Date.format(d,{displayTime:"datetime"===o}):"string"===o&&s._t.test(d)?(0,a.jsx)("a",{href:d,target:"_blank",children:d}):String(d))},t);var o,d}.bind(this))},l)}.bind(this))})]})}),P.length>T.l&&(0,a.jsx)(x.A,{id:"selection-table-pagination",component:"div",count:P.length,rowsPerPage:T.l,page:I,onPageChange:_,labelRowsPerPage:(0,y.Tl)("row.per.page")})]})});var H=void 0;const J=function SelectionPageFn(e){return(0,i.A)(this,H),(0,a.jsx)(o.A,{theme:e.theme,children:(0,a.jsx)(I,{})})}.bind(void 0),$=(0,d.Ng)(function(e){return(0,i.A)(this,H),{theme:e.external[s.sZ].ui.theme}}.bind(void 0))(J),z=function SelectionPage(){return(0,i.A)(this,H),(0,a.jsx)(d.Kq,{store:JMap.getDataStore(),children:(0,a.jsx)($,{})})}.bind(void 0);function startSelectionPage(){var e=this;window.addEventListener("beforeunload",function(){(0,i.A)(this,e),JMap.Application.Selection.closeTableTab()}.bind(this));r.H(document.body).render((0,a.jsx)(l.StrictMode,{children:(0,a.jsx)(z,{})}))}}}]);
|