@fishawack/lab-velocity 2.0.0-beta.5 → 2.0.0-beta.50

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.
Files changed (111) hide show
  1. package/README.md +467 -36
  2. package/_Build/js/libs/build-id.js +14 -0
  3. package/_Build/js/libs/filters.js +36 -0
  4. package/_Build/js/libs/globals.js +7 -0
  5. package/_Build/js/libs/router.js +22 -0
  6. package/_Build/js/libs/routes.js +29 -0
  7. package/_Build/js/libs/store.js +21 -0
  8. package/_Build/js/libs/utility.js +161 -0
  9. package/_Build/vue/components/basic/Button.vue +1 -1
  10. package/_Build/vue/components/form/Avatar.vue +90 -0
  11. package/_Build/vue/components/form/Checkbox.vue +10 -0
  12. package/_Build/vue/components/form/InputNumber.vue +1 -1
  13. package/_Build/vue/components/form/Select.vue +223 -33
  14. package/_Build/vue/components/form/Spinner.vue +5 -0
  15. package/_Build/vue/components/layout/Alert.vue +5 -5
  16. package/_Build/vue/components/layout/Audit.vue +143 -0
  17. package/_Build/vue/{modules/AuthModule/components/VBreadcrumbs.vue → components/layout/Breadcrumbs.vue} +4 -4
  18. package/_Build/vue/{modules/AuthModule/components → components/layout}/Chips.vue +2 -2
  19. package/_Build/vue/components/layout/Footer.vue +11 -10
  20. package/_Build/vue/{modules/AuthModule/components/VFormFooter.vue → components/layout/FormFooter.vue} +13 -7
  21. package/_Build/vue/{modules/AuthModule/components → components/layout}/FormRole.vue +10 -8
  22. package/_Build/vue/components/layout/Layout.vue +94 -0
  23. package/_Build/vue/components/layout/Navigation.vue +77 -0
  24. package/_Build/vue/{modules/AuthModule/components/VPageHeader.vue → components/layout/PageHeader.vue} +14 -8
  25. package/_Build/vue/components/layout/SideBar.vue +26 -0
  26. package/_Build/vue/{modules/AuthModule/components/VTable.vue → components/layout/Table.vue} +37 -16
  27. package/_Build/vue/{modules/AuthModule/components/VTableSorter.vue → components/layout/TableSorter.vue} +108 -52
  28. package/_Build/vue/components/layout/TokenDisplay.vue +52 -0
  29. package/_Build/vue/components/layout/pageTitle.vue +1 -1
  30. package/_Build/vue/components/navigation/MenuItem.vue +7 -2
  31. package/_Build/vue/components/navigation/MenuItemGroup.vue +7 -2
  32. package/_Build/vue/modules/AuthModule/js/axios.js +21 -1
  33. package/_Build/vue/modules/AuthModule/js/guest-request.js +32 -0
  34. package/_Build/vue/modules/AuthModule/js/impersonation-banner.js +102 -0
  35. package/_Build/vue/modules/AuthModule/js/router.js +91 -114
  36. package/_Build/vue/modules/AuthModule/js/store.js +23 -6
  37. package/_Build/vue/modules/AuthModule/routes/PCompanies/columns.js +268 -0
  38. package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +213 -0
  39. package/_Build/vue/modules/AuthModule/routes/PIntegrations/columns.js +58 -0
  40. package/_Build/vue/modules/AuthModule/routes/PIntegrations/resource.js +79 -0
  41. package/_Build/vue/modules/AuthModule/routes/PTeams/columns.js +78 -0
  42. package/_Build/vue/modules/AuthModule/routes/PTeams/resource.js +251 -0
  43. package/_Build/vue/modules/AuthModule/routes/PUsers/SetPasswordAction.vue +51 -0
  44. package/_Build/vue/modules/AuthModule/routes/PUsers/SetPasswordDialog.vue +138 -0
  45. package/_Build/vue/modules/AuthModule/routes/PUsers/columns.js +349 -0
  46. package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +239 -0
  47. package/_Build/vue/modules/AuthModule/routes/account-exists.vue +2 -2
  48. package/_Build/vue/modules/AuthModule/routes/change-password.vue +28 -32
  49. package/_Build/vue/modules/AuthModule/routes/container.vue +2 -11
  50. package/_Build/vue/modules/AuthModule/routes/expired-reset.vue +4 -4
  51. package/_Build/vue/modules/AuthModule/routes/expired-verification.vue +10 -9
  52. package/_Build/vue/modules/AuthModule/routes/force-reset.vue +44 -58
  53. package/_Build/vue/modules/AuthModule/routes/forgot.vue +10 -5
  54. package/_Build/vue/modules/AuthModule/routes/login.vue +12 -19
  55. package/_Build/vue/modules/AuthModule/routes/logincallback.vue +1 -3
  56. package/_Build/vue/modules/AuthModule/routes/loginsso.vue +14 -10
  57. package/_Build/vue/modules/AuthModule/routes/logout.vue +17 -5
  58. package/_Build/vue/modules/AuthModule/routes/logoutheadless.vue +1 -3
  59. package/_Build/vue/modules/AuthModule/routes/register.vue +24 -28
  60. package/_Build/vue/modules/AuthModule/routes/reset.vue +20 -14
  61. package/_Build/vue/modules/AuthModule/routes/success-forgot.vue +14 -8
  62. package/_Build/vue/modules/AuthModule/routes/success-reset.vue +2 -2
  63. package/_Build/vue/modules/AuthModule/routes/success-verify.vue +1 -3
  64. package/_Build/vue/modules/AuthModule/routes/verify.vue +11 -14
  65. package/_Build/vue/modules/resource/Children/create.vue +81 -0
  66. package/_Build/vue/modules/resource/Children/edit.vue +106 -0
  67. package/_Build/vue/modules/resource/Children/index.vue +42 -0
  68. package/_Build/vue/modules/resource/Children/partials/form.vue +111 -0
  69. package/_Build/vue/modules/resource/Children/show.vue +166 -0
  70. package/_Build/vue/modules/resource/index.js +561 -0
  71. package/_Build/vue/modules/resource/parent.vue +63 -0
  72. package/_Build/vue/modules/resource/trashable.js +104 -0
  73. package/_base.scss +0 -1
  74. package/_defaults.scss +2 -13
  75. package/_variables.scss +9 -4
  76. package/{modules/_AuthModule.scss → components/_auth.scss} +19 -68
  77. package/components/_datepicker.scss +1 -0
  78. package/components/_descriptions.scss +2 -0
  79. package/components/_footer.scss +1 -0
  80. package/components/_form.scss +18 -0
  81. package/components/_header.scss +3 -27
  82. package/components/_layout.scss +56 -0
  83. package/components/_menu.scss +0 -5
  84. package/components/_sidebar.scss +12 -27
  85. package/components/_table.scss +3 -0
  86. package/components/_token-display.scss +41 -0
  87. package/general.scss +1 -0
  88. package/index.js +31 -1
  89. package/package.json +7 -4
  90. package/vendor.scss +0 -1
  91. package/_Build/vue/components/layout/sideBar.vue +0 -25
  92. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/Upload/upload.vue +0 -251
  93. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/create.vue +0 -62
  94. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/edit.vue +0 -98
  95. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/index.vue +0 -90
  96. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/partials/form.vue +0 -173
  97. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/Children/show.vue +0 -262
  98. package/_Build/vue/modules/AuthModule/adminRoutes/PCompanies/parent.vue +0 -36
  99. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/create.vue +0 -112
  100. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/edit.vue +0 -103
  101. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/index.vue +0 -112
  102. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/partials/form.vue +0 -169
  103. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/Children/show.vue +0 -120
  104. package/_Build/vue/modules/AuthModule/adminRoutes/PUsers/parent.vue +0 -36
  105. package/components/_input.scss +0 -0
  106. package/modules/_AuthVariables.scss +0 -7
  107. /package/_Build/vue/{modules/AuthModule/components → components/layout}/AuthModal.vue +0 -0
  108. /package/_Build/vue/{modules/AuthModule/components → components/layout}/Chip.vue +0 -0
  109. /package/_Build/vue/{modules/AuthModule/components/VPasswordValidation.vue → components/layout/PasswordValidation.vue} +0 -0
  110. /package/_Build/vue/{modules/AuthModule/components/VRoleLegend.vue → components/layout/RoleLegend.vue} +0 -0
  111. /package/{modules → components}/_modal.scss +0 -0
package/README.md CHANGED
@@ -10,65 +10,496 @@ Prevent code repetition.
10
10
 
11
11
  ## Getting started
12
12
 
13
+ ### Requirements
14
+
15
+ ```json
16
+ "vue": "^3.3.4",
17
+ "vue-router": "^4.2.4",
18
+ "vuex": "^4.1.0",
19
+ "vuex-persistedstate": "^4.1.0"
20
+ "vue-loader": "^17.2.2"
21
+ ```
22
+
13
23
  ### Install
14
24
 
15
25
  ```bash
16
26
  npm install @fishawack/lab-velocity
17
27
  ```
18
28
 
19
- ### Auth Module
29
+ ## Hydrate Views
30
+
31
+ Frontend & Admin files to work with the Hydrate Module including routes, store, axios and components.
32
+
33
+ ### Installation
34
+
35
+ ### Configure axios
36
+
37
+ ##### script.js
38
+
39
+ ```js
40
+ import { Auth } from "@fishawack/lab-velocity";
41
+
42
+ // Call in your boot method
43
+ Auth.Axios.setAxiosDefaults(process.env.APP_URL, router);
44
+ ```
45
+
46
+ ### Configure router
47
+
48
+ ##### router.js
49
+
50
+ ```js
51
+ import { Auth } from "@fishawack/lab-velocity";
52
+ import store from "./store.js";
53
+
54
+ // ... initialize router
55
+
56
+ Auth.Router.beforeEach(router, store);
57
+ ```
58
+
59
+ ### Configure routes
60
+
61
+ There are two different set of routes for the admin and the frontend.
62
+
63
+ ##### routes.js
64
+
65
+ ```js
66
+ import { Auth } from "@fishawack/lab-velocity";
67
+
68
+ [
69
+ // ... other routes
70
+
71
+ // End user routes for login, register, chang password etc
72
+ ...Auth.Router.routes(node),
73
+
74
+ // Admin routes for headless login & managing users & companies
75
+ ...Auth.Router.adminRoutes(node),
76
+
77
+ // ... wildcard 404 routes etc
78
+ ];
79
+ ```
80
+
81
+ You can override the default setup for companies & user resources by passing an optional second object to the `adminRoutes` method. See the [resources](#Resources) section below for available options.
82
+
83
+ ```js
84
+ ...Auth.Router.adminRoutes(node, {
85
+ userResource: {
86
+ label: "Custom User label",
87
+ api: `/api/v2/users`,
88
+ }
89
+ })
90
+ ```
91
+
92
+ ### Configure store
93
+
94
+ ##### store.js
95
+
96
+ ```js
97
+ import { Auth } from "@fishawack/lab-velocity";
98
+
99
+ // Call in store
100
+ {
101
+ plugins: [
102
+ VuexPersistedState({
103
+ // ...
104
+ paths: ["auth.user"],
105
+ }),
106
+ Auth.ImpersonationPlugin,
107
+ ],
108
+
109
+ modules: {
110
+ auth: Auth.Store,
111
+ },
112
+
113
+ // ...
114
+ }
115
+ ```
116
+
117
+ `Auth.ImpersonationPlugin` displays a persistent banner when an admin is impersonating another user, persisted across page reloads.
118
+
119
+ ### Base Styles
120
+
121
+ @fishawack/lab-velocity extends @fishawack/lab-ui, for this reason you should replace the two references to variables & defaults with @fishawack/lab-velocity ones.
122
+
123
+ #### \_variables.scss
124
+
125
+ ```sass
126
+ @import "@fishawack/lab-velocity/variables";
127
+
128
+ // Set global variables here, e.g $color6: red;
129
+ ```
130
+
131
+ #### \_defaults.scss
132
+
133
+ ```sass
134
+ @use "variables";
135
+ @import "@fishawack/lab-velocity/defaults";
136
+
137
+ $colors: variables.dynamic("color", module-variables("variables"));
138
+
139
+ // Override lab-ui defaults here, e.g $button: $color6;
140
+ ```
141
+
142
+ ### Route Styles
143
+
144
+ There are two different set of sass imports for the admin and the frontend routes.
145
+
146
+ #### Frontend
147
+
148
+ ```sass
149
+ // Vendor imports / Lab-ui imports
150
+ @import "@fishawack/lab-ui/typography";
151
+ @import "@fishawack/lab-ui/grid";
152
+ @import "@fishawack/lab-ui/utilities";
153
+ @import "@fishawack/lab-ui/icon";
154
+
155
+ // Lab velocity
156
+ @import "@fishawack/lab-velocity/base";
157
+ @import "@fishawack/lab-velocity/components/basic";
158
+ @import "@fishawack/lab-velocity/components/button";
159
+ @import "@fishawack/lab-velocity/components/form";
160
+ @import "@fishawack/lab-velocity/components/auth";
161
+ ```
162
+
163
+ #### Admin
20
164
 
21
- Frontend files to to work with the Hydrate Module.
165
+ ##### vendor.scss
22
166
 
23
- #### Installation
167
+ ```sass
168
+ // Vendor imports / Lab-ui imports
169
+ @import "@fishawack/lab-ui/typography";
170
+ @import "@fishawack/lab-ui/grid";
171
+ @import "@fishawack/lab-ui/utilities";
172
+ @import "@fishawack/lab-ui/icon";
24
173
 
25
- ##### Import Axios File
174
+ // Lab velocity
175
+ @import "@fishawack/lab-velocity/base";
176
+ @import "@fishawack/lab-velocity/components/pageTitle";
177
+ @import "@fishawack/lab-velocity/components/breadcrumbs";
178
+ @import "@fishawack/lab-velocity/components/table";
179
+ @import "@fishawack/lab-velocity/components/icon";
180
+ @import "@fishawack/lab-velocity/components/basic";
181
+ @import "@fishawack/lab-velocity/components/button";
182
+ @import "@fishawack/lab-velocity/components/form";
183
+ @import "@fishawack/lab-velocity/components/checkbox";
184
+ @import "@fishawack/lab-velocity/components/select";
185
+ @import "@fishawack/lab-velocity/components/loader";
186
+ @import "@fishawack/lab-velocity/components/permissionLegend";
187
+ @import "@fishawack/lab-velocity/components/chip";
188
+ @import "@fishawack/lab-velocity/components/header";
189
+ @import "@fishawack/lab-velocity/components/footer";
190
+ @import "@fishawack/lab-velocity/components/sidebar";
191
+ @import "@fishawack/lab-velocity/components/menu";
192
+ @import "@fishawack/lab-velocity/components/layout";
193
+ @import "@fishawack/lab-velocity/components/descriptions";
194
+ @import "@fishawack/lab-velocity/components/token-display";
195
+ @import "element-plus/theme-chalk/el-tabs";
196
+ @import "element-plus/theme-chalk/el-tab-pane";
197
+ ```
26
198
 
27
- import axios from "axios";
28
- import "@fishawack/lab-velocity/AuthModule/js/AuthAxios.js";
199
+ Lastly for the admin layout & navigation import & apply the Layout component to the app.vue within your project.
29
200
 
30
- ##### Import Routes File
201
+ ```vue
202
+ <template>
203
+ <main id="app">
204
+ <VelLayout>
205
+ <router-view />
206
+ </VelLayout>
207
+ </main>
208
+ </template>
31
209
 
32
- Inside Router.js file
33
- import { authRoutes, configureRoutes } from "@fishawack/lab-velocity/AuthModule/js/AuthRoutes";
210
+ <script>
211
+ import { Layout as VelLayout } from "@fishawack/lab-velocity";
212
+ export default {
213
+ components: {
214
+ VelLayout,
215
+ },
216
+ };
217
+ </script>
218
+ ```
34
219
 
35
- let routes = require("./routes.js")(null, store).concat(authRoutes(null,store,store.state.auth.authBase));
36
- Add routes to createRouter call
220
+ ### Icons
37
221
 
38
- add method call after createRouter
39
- configureRoutes(router);
222
+ Ensure Content has Velocity pulled in & copy out the svg folder contents into the svg files within vue.
223
+
224
+ ```json
225
+ {
226
+ "aws-s3": "fishawack",
227
+ "location": "fw-auto-content/lab-velocity",
228
+ "key": "fw-s3-lab-velocity"
229
+ }
230
+ ```
231
+
232
+ ### ENV VARS (frontend)
233
+
234
+ ```env
235
+ # Descriptions
236
+ HYDRATE_LOGO Name of primary logo (default: example-logo)
237
+ HYDRATE_LOGO_REVERSE Name of the logo when color scheme is reversed (default: to HYDRATE_LOGO value if not provided)
238
+ HYDRATE_REDIRECT Name of the route name to redirect to after login (default: index)
239
+ HYDRATE_CONTACT Email for contact us button (default: mailto:det@avalerehealth.com)
240
+ ```
241
+
242
+ ## Resources
243
+
244
+ To reduce the amount of template code needed you can import a fairly standard set of route files for index, show, create, edit & form via the resource module.
245
+
246
+ ##### routes.js
247
+
248
+ ```js
249
+ import { Resource } from "@fishawack/lab-velocity";
250
+
251
+ [
252
+ // ... other routes
253
+ ...Resource.routes(node, "posts"),
254
+ ];
255
+ ```
40
256
 
41
- ##### Import Store
257
+ A third optional object can be passed for meta data that contains all of the overrides to customize the full rendering of these resource files. The default meta object is below.
42
258
 
43
- import AuthStore from "@fishawack/lab-velocity/AuthModule/js/AuthStore.js";
44
- Inside createStore method add
45
- modules: {
46
- auth: AuthStore
259
+ ```js
260
+ // Name is the first param, properties is the optional second param
261
+ export function meta(name, properties = {}) {
262
+ const singular = properties.singular || name.slice(0, -1);
263
+
264
+ return merge(
265
+ {
266
+ name,
267
+ title: properties.title || name[0].toUpperCase() + name.slice(1),
268
+ singular,
269
+ label: singular,
270
+ multiLabel: name,
271
+ pageLink: name,
272
+ api: `/api/${name}`,
273
+ permissions: {
274
+ create: () => true,
275
+ edit: () => true,
276
+ },
277
+ searchable: {
278
+ value: "name",
279
+ label: `Search ${name}`,
280
+ },
281
+ form: {
282
+ component: null,
283
+ fields: () => ({}),
284
+ },
285
+ table: {
286
+ structure: [
287
+ {
288
+ key: "id",
289
+ },
290
+ ],
291
+ },
292
+ description: {
293
+ structure: [
294
+ {
295
+ key: "id",
296
+ },
297
+ ],
298
+ },
299
+ index: {
300
+ actions: [],
301
+ layout: [
302
+ (props) => {
303
+ const { resource } = props;
304
+
305
+ return h(VTableSorter, {
306
+ key: "PIndex",
307
+ "json-data": {
308
+ ...resource,
309
+ tableStructure: resource.table.structure,
310
+ },
311
+ defaults: resource.defaults,
312
+ "fixed-height": false,
313
+ "display-edit-action":
314
+ resource.permissions.create(props),
315
+ });
316
+ },
317
+ ],
318
+ },
319
+ show: {
320
+ actions: [],
321
+ layout: [
322
+ (props) => {
323
+ const { resource, model } = props;
324
+
325
+ return h(
326
+ ElDescriptions,
327
+ {
328
+ border: true,
329
+ column: 1,
330
+ },
331
+ resource.description.structure.map((item, index) =>
332
+ h(
333
+ ElDescriptionsItem,
334
+ {
335
+ key: index,
336
+ labelWidth: "20%",
337
+ },
338
+ {
339
+ label: () =>
340
+ item.label ||
341
+ item.key[0].toUpperCase() +
342
+ item.key.slice(1),
343
+ default: () =>
344
+ item.render
345
+ ? h(item.render(props))
346
+ : model?.[item.key] || "",
347
+ },
348
+ ),
349
+ ),
350
+ );
351
+ },
352
+ ],
353
+ },
354
+ defaults: "",
355
+ icon: `icon-${singular}`,
47
356
  },
48
- Inside VuexPersistedState add
49
- paths:["auth"]
357
+ properties,
358
+ );
359
+ }
360
+ ```
361
+
362
+ Layout is an array of functions that return render functions
363
+
364
+ ```js
365
+ import { h, resolveComponent } from "vue";
50
366
 
51
- At bottom of file set
52
- window.store = store;
367
+ {
368
+ // ...
369
+ show: {
370
+ layout: [
371
+ ({ model }) =>
372
+ h(resolveComponent("router-link"), {
373
+ class: "underline",
374
+ to: {
375
+ name: "companies.show",
376
+ params: { id: model.company_id },
377
+ },
378
+ text: model.company.name,
379
+ })
380
+ ],
381
+ },
382
+ }
383
+ ```
384
+
385
+ You can see above that the show & index route have a default render function returned for a table and description block. If you want to keep this you can grab the existing render function from the `defaultResource` export.
386
+
387
+ ```js
388
+ import { defaultResource, meta } from "../../../resource/index.js";
389
+
390
+ {
391
+ // ...
392
+ index: {
393
+ layout: [
394
+ () => h("div", "I appear above"),
395
+ ...defaultResource.index.layout,
396
+ () => h("div", "I appear below"),
397
+ ],
398
+ },
399
+ }
400
+ ```
53
401
 
54
- ##### SVGS
402
+ Structure arrays take objects. The objects require a key only but have other optional properties. A render function can also be passed to fully customize the rendering that happens.
55
403
 
56
- Ensure Content has Velocity pulled in
57
- {
58
- "lftp": "ftp-fishawack.egnyte.com",
59
- "location": "Shared/FW/Knutsford/Digital/Auto-Content/Lab/Velocity"
404
+ ```js
405
+ {
406
+ table: {
407
+ structure: [
408
+ {
409
+ key: "name",
410
+ sortable: true,
411
+ },
412
+ {
413
+ key: "role",
414
+ render: () => h("div", "Custom template"),
415
+ },
416
+ ],
417
+ },
418
+ form: {
419
+ structure: [
420
+ {
421
+ key: "name",
422
+ },
423
+ {
424
+ key: "provider_name",
425
+ label: "Provider",
426
+ render: ({ model }) => h("span", model?.provider_name.label ?? ""),
427
+ initial: ({ model }) => model?.provider_name.value ?? null,
428
+ }
429
+ ]
60
430
  }
61
- Copy out the svg folder contents into the svg files within vue.
431
+ }
432
+ ```
433
+
434
+ Generally speaking the only different between admin routes tends to do the columns which within a model are shared. Because of this you can use the utility method `columns` to automatically build out the table, description & form fields using the following syntax.
435
+
436
+ ```js
437
+ import { Resource } from "@fishawack/lab-velocity";
438
+ import { Checkbox as VelCheckbox } from "@fishawack/lab-velocity";
439
+
440
+ {
441
+ api: `/api/posts`,
442
+ icon: `icon-visibility`,
443
+ permissions: {
444
+ create: ({ $store }) => $store.getters.can("write personas"),
445
+ edit: ({ $store }) => $store.getters.can("write personas"),
446
+ },
447
+ ...Resource.columns(
448
+ [
449
+ {
450
+ key: "name",
451
+ sortable: true,
452
+ },
453
+ {
454
+ key: "description",
455
+ },
456
+ {
457
+ key: "is_experimental",
458
+ label: "Experimental",
459
+ render: {
460
+ write: () => h(VelCheckbox),
461
+ },
462
+ initial: ({ model }) => model?.is_experimental ?? false,
463
+ },
464
+ {
465
+ key: "nested",
466
+ label: "Nested",
467
+ render: {
468
+ read: ({ model }) =>
469
+ h("span", model?.nested.name ?? ""),
470
+ },
471
+ initial: ({ model }) =>
472
+ model?.nested.id ?? null,
473
+ },
474
+ {
475
+ key: "client_id",
476
+ label: "Client id",
477
+ filter: {
478
+ form: true
479
+ }
480
+ }
481
+ ]
482
+ ),
483
+ },
484
+ ```
62
485
 
63
- ##### ENV VARS
486
+ ## Local dev
64
487
 
65
- HYDRATE_LOGO=example-logo
488
+ To work locally mount a local clone of the project into the packages directory via an overridden docker compose file.
66
489
 
67
- HYDRATE_LOGO=example-logo(No Default set, name of svg logo to display on page)
68
- HYDRATE_REDIRECT=(Default index if not configured)
69
- HYDRATE_CONTACT=(Default mailto:EP@avalerehealth, Email for contact us button)
490
+ ### Docker setup
70
491
 
71
- ##### Verify dependencies are installed
492
+ Create a docker compose file at `_Docker/docker-compose.yml`
72
493
 
73
- Axios
74
- form-backend-validation
494
+ ```yml
495
+ services:
496
+ core:
497
+ volumes:
498
+ - $PWD/../lab-velocity:/app/packages/lab-velocity
499
+ ```
500
+
501
+ ### Npm install
502
+
503
+ ```bash
504
+ npm install ./packages/lab-velocity
505
+ ```
@@ -0,0 +1,14 @@
1
+ if (process.env.NODE_ENV === "production") {
2
+ let uuid = document.documentElement.dataset.build;
3
+ let last = window.localStorage.getItem(`${process.env.REPO_NAME}-build-id`);
4
+
5
+ if (!last) {
6
+ console.log("no build detected - setting");
7
+ window.localStorage.clear();
8
+ window.localStorage.setItem(`${process.env.REPO_NAME}-build-id`, uuid);
9
+ } else if (uuid !== last) {
10
+ console.log("new build detected - resetting storage");
11
+ window.localStorage.clear();
12
+ window.localStorage.setItem(`${process.env.REPO_NAME}-build-id`, uuid);
13
+ }
14
+ }
@@ -0,0 +1,36 @@
1
+ import dayjs from "dayjs";
2
+ import calendar from "dayjs/plugin/calendar";
3
+ import localizedFormat from "dayjs/plugin/localizedFormat";
4
+ import "dayjs/locale/en-gb";
5
+
6
+ dayjs.extend(calendar);
7
+ dayjs.extend(localizedFormat);
8
+ dayjs.locale(navigator.language.toLowerCase());
9
+
10
+ export function ucfirst(value) {
11
+ if (!value) return "";
12
+ value = value.toString();
13
+ return value.charAt(0).toUpperCase() + value.slice(1);
14
+ }
15
+
16
+ export function calendarFormat(value) {
17
+ return !value
18
+ ? ""
19
+ : dayjs(value).calendar(null, {
20
+ sameElse: "DD/MM/YYYY",
21
+ });
22
+ }
23
+
24
+ export function dateFormat(value) {
25
+ return !value ? "" : dayjs(value).format("LLL");
26
+ }
27
+
28
+ export default {
29
+ install(Vue) {
30
+ Vue.config.globalProperties.$filters = {
31
+ ucfirst,
32
+ calendarFormat,
33
+ dateFormat,
34
+ };
35
+ },
36
+ };
@@ -0,0 +1,7 @@
1
+ import GSvg from "../../vue/modules/GSvg.vue";
2
+
3
+ export default {
4
+ install(Vue) {
5
+ // Vue.component("GSvg", GSvg);
6
+ },
7
+ };
@@ -0,0 +1,22 @@
1
+ import { createRouter, createWebHistory } from "vue-router";
2
+ import { Auth } from "../../../index.js";
3
+
4
+ const router = createRouter({
5
+ history: createWebHistory(),
6
+ linkExactActiveClass: "active",
7
+ base: process.env.BASE_URL,
8
+ routes: require("./routes.js")(),
9
+ });
10
+
11
+ router.beforeEach((to, from, next) => {
12
+ // Enforce routes have trailing forward slash
13
+ if (to.path.substr(-1) != "/") {
14
+ return next({ path: `${to.path}/`, query: to.query, hash: to.hash });
15
+ }
16
+
17
+ return next();
18
+ });
19
+
20
+ Auth.Router.beforeEach(router);
21
+
22
+ export default router;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ module.exports = (node) => [
4
+ {
5
+ path: "/",
6
+ component: node ? "" : require("../../vue/routes/PIndex.vue").default,
7
+ name: "index",
8
+ meta: {
9
+ guest: true,
10
+ },
11
+ },
12
+ {
13
+ path: "/404",
14
+ component: node ? "" : require("../../vue/routes/P404.vue").default,
15
+ meta: {
16
+ guest: true,
17
+ },
18
+ },
19
+ {
20
+ path: "/index.html",
21
+ redirect: "/",
22
+ prerender: false,
23
+ },
24
+ {
25
+ path: "/:pathMatch(.*)*",
26
+ redirect: "/404",
27
+ prerender: false,
28
+ },
29
+ ];
@@ -0,0 +1,21 @@
1
+ import { createStore } from "vuex";
2
+ import VuexPersistedState from "vuex-persistedstate";
3
+ import { Auth } from "../../../index.js";
4
+
5
+ const store = createStore({
6
+ modules: {
7
+ auth: Auth.Store,
8
+ },
9
+ plugins: [
10
+ VuexPersistedState({
11
+ key: document.title,
12
+ paths: ["auth"],
13
+ }),
14
+ ],
15
+
16
+ state: {},
17
+
18
+ mutations: {},
19
+ });
20
+
21
+ export default store;