@fishawack/lab-velocity 2.0.0-beta.40 → 2.0.0-beta.42

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 (30) hide show
  1. package/README.md +4 -2
  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/form/Avatar.vue +86 -0
  10. package/_Build/vue/components/layout/Audit.vue +124 -56
  11. package/_Build/vue/components/layout/Layout.vue +19 -1
  12. package/_Build/vue/components/layout/TableSorter.vue +42 -12
  13. package/_Build/vue/modules/AuthModule/js/router.js +20 -36
  14. package/_Build/vue/modules/AuthModule/routes/PCompanies/columns.js +268 -0
  15. package/_Build/vue/modules/AuthModule/routes/PCompanies/resource.js +173 -232
  16. package/_Build/vue/modules/AuthModule/routes/PIntegrations/resource.js +122 -0
  17. package/_Build/vue/modules/AuthModule/routes/PTeams/resource.js +1 -0
  18. package/_Build/vue/modules/AuthModule/routes/PUsers/columns.js +349 -0
  19. package/_Build/vue/modules/AuthModule/routes/PUsers/resource.js +142 -262
  20. package/_Build/vue/modules/resource/Children/create.vue +2 -2
  21. package/_Build/vue/modules/resource/Children/edit.vue +2 -2
  22. package/_Build/vue/modules/resource/Children/partials/form.vue +71 -21
  23. package/_Build/vue/modules/resource/Children/show.vue +24 -2
  24. package/_Build/vue/modules/resource/index.js +12 -4
  25. package/components/_form.scss +18 -0
  26. package/components/_menu.scss +0 -5
  27. package/index.js +16 -0
  28. package/package.json +3 -1
  29. package/_Build/vue/modules/AuthModule/routes/PCompanies/form.vue +0 -205
  30. package/_Build/vue/modules/AuthModule/routes/PUsers/form.vue +0 -193
@@ -12,6 +12,7 @@ import {
12
12
  ElNotification,
13
13
  } from "element-plus";
14
14
  import VelButton from "../../components/basic/Button.vue";
15
+ import VelAudit from "../../components/layout/Audit.vue";
15
16
 
16
17
  export const defaultResource = meta();
17
18
 
@@ -50,12 +51,15 @@ export function meta(name = "default", properties = {}) {
50
51
  value: "name",
51
52
  label: `Search ${name}`,
52
53
  },
54
+ auditable: false,
53
55
  form: {
54
56
  component: null,
55
57
  submit: null,
58
+ class: "grid__1/2",
56
59
  fields: () => ({}),
57
60
  preparation: ({ form }) => form.data(),
58
61
  structure: [],
62
+ groups: {},
59
63
  },
60
64
  table: {
61
65
  actions: [
@@ -488,21 +492,24 @@ export function routes(node, name, properties = {}, children = []) {
488
492
  path: "",
489
493
  component: node
490
494
  ? ""
491
- : require("../resource/Children/index.vue").default,
495
+ : resource.index.component ||
496
+ require("../resource/Children/index.vue").default,
492
497
  name: `${resource.routeName}.index`,
493
498
  },
494
499
  {
495
500
  path: "create",
496
501
  component: node
497
502
  ? ""
498
- : require("../resource/Children/create.vue").default,
503
+ : resource.create?.component ||
504
+ require("../resource/Children/create.vue").default,
499
505
  name: `${resource.routeName}.create`,
500
506
  },
501
507
  {
502
508
  path: `:${resource.id}`,
503
509
  component: node
504
510
  ? ""
505
- : require("../resource/Children/show.vue").default,
511
+ : resource.show.component ||
512
+ require("../resource/Children/show.vue").default,
506
513
  name: `${resource.routeName}.show`,
507
514
  // Remove leading / for nested routes or they'll resolve to the root of the site
508
515
  children: cloneDeepWith(children, (value, key) => {
@@ -522,7 +529,8 @@ export function routes(node, name, properties = {}, children = []) {
522
529
  path: `:${resource.id}/edit`,
523
530
  component: node
524
531
  ? ""
525
- : require("../resource/Children/edit.vue").default,
532
+ : resource.edit?.component ||
533
+ require("../resource/Children/edit.vue").default,
526
534
  name: `${resource.routeName}.edit`,
527
535
  meta: {
528
536
  breadcrumb: ({ $route }) => $route.params[resource.id],
@@ -22,3 +22,21 @@
22
22
  }
23
23
  }
24
24
  }
25
+
26
+ .vel-resource-form {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: 2.5 * $spacing;
30
+ }
31
+
32
+ .vel-form-group {
33
+ border: 1px solid lighten($color4, 3%);
34
+ border-radius: $spacing * 0.5;
35
+ padding: 2 * $spacing;
36
+
37
+ legend {
38
+ font-weight: 600;
39
+ font-size: get-ratio(16px);
40
+ padding: 0 $spacing * 0.5;
41
+ }
42
+ }
@@ -93,11 +93,6 @@ ul.vel-menu {
93
93
  flex-direction: column;
94
94
  height: 100%;
95
95
 
96
- li:last-child {
97
- margin-top: auto;
98
- margin-bottom: 0px;
99
- }
100
-
101
96
  .el-sub-menu {
102
97
  .vel-menu-item {
103
98
  a.active {
package/index.js CHANGED
@@ -10,6 +10,13 @@ export const Auth = {
10
10
 
11
11
  export { default as Resource } from "./_Build/vue/modules/resource/index.js";
12
12
 
13
+ export { default as UserResource } from "./_Build/vue/modules/AuthModule/routes/PUsers/resource.js";
14
+ export { default as UserColumns } from "./_Build/vue/modules/AuthModule/routes/PUsers/columns.js";
15
+ export { default as CompanyResource } from "./_Build/vue/modules/AuthModule/routes/PCompanies/resource.js";
16
+ export { default as CompanyColumns } from "./_Build/vue/modules/AuthModule/routes/PCompanies/columns.js";
17
+ export { default as TeamResource } from "./_Build/vue/modules/AuthModule/routes/PTeams/resource.js";
18
+ export { default as IntegrationResource } from "./_Build/vue/modules/AuthModule/routes/PIntegrations/resource.js";
19
+
13
20
  export { default as Button } from "./_Build/vue/components/basic/Button.vue";
14
21
  export { default as Link } from "./_Build/vue/components/basic/link.vue";
15
22
 
@@ -24,9 +31,11 @@ export { default as Switch } from "./_Build/vue/components/form/Switch.vue";
24
31
  export { default as Wysiwyg } from "./_Build/vue/components/form/Wysiwyg.vue";
25
32
  export { default as Wysiwyg2 } from "./_Build/vue/components/form/Wysiwyg2.vue";
26
33
  export { default as Upload } from "./_Build/vue/components/form/Upload.vue";
34
+ export { default as Avatar } from "./_Build/vue/components/form/Avatar.vue";
27
35
  export { default as InputNumber } from "./_Build/vue/components/form/InputNumber.vue";
28
36
 
29
37
  export { default as RoleLegend } from "./_Build/vue/components/layout/RoleLegend.vue";
38
+ export { default as FormRole } from "./_Build/vue/components/layout/FormRole.vue";
30
39
  export { default as TableSorter } from "./_Build/vue/components/layout/TableSorter.vue";
31
40
  export { default as Chip } from "./_Build/vue/components/layout/Chip.vue";
32
41
  export { default as Chips } from "./_Build/vue/components/layout/Chips.vue";
@@ -49,3 +58,10 @@ export { default as BreadcrumbsItem } from "./_Build/vue/components/navigation/B
49
58
  export { default as Icon } from "./_Build/vue/components/Icon.vue";
50
59
  export { default as Svg } from "./_Build/vue/components/Svg.vue";
51
60
  export { default as Loader } from "./_Build/vue/components/layout/Loader.vue";
61
+
62
+ export { default as Filters } from "./_Build/js/libs/filters.js";
63
+ export {
64
+ ucfirst,
65
+ calendarFormat,
66
+ dateFormat,
67
+ } from "./_Build/js/libs/filters.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-velocity",
3
- "version": "2.0.0-beta.40",
3
+ "version": "2.0.0-beta.42",
4
4
  "description": "Avalere Health branded style system",
5
5
  "scripts": {
6
6
  "setup": "npm ci || npm i && npm run content",
@@ -54,6 +54,7 @@
54
54
  "@tiptap/starter-kit": "^2.11.2",
55
55
  "@tiptap/vue-3": "^2.11.2",
56
56
  "axios": "^1.11.0",
57
+ "dayjs": "^1.11.20",
57
58
  "element-plus": "^2.11.8",
58
59
  "form-backend-validation": "github:mikemellor11/form-backend-validation#master",
59
60
  "lodash": "^4.17.21",
@@ -63,6 +64,7 @@
63
64
  "files": [
64
65
  "*.scss",
65
66
  "components",
67
+ "_Build/js/libs",
66
68
  "_Build/vue/components",
67
69
  "_Build/vue/modules/AuthModule",
68
70
  "_Build/vue/modules/resource"
@@ -1,205 +0,0 @@
1
- <!-- eslint-disable vue/no-mutating-props -->
2
- <template>
3
- <form class="" @submit.prevent="submit">
4
- <VelBasic
5
- v-model="form.name"
6
- name="name"
7
- :error="form.errors"
8
- type="text"
9
- placeholder="Name"
10
- label="Company name"
11
- >
12
- <template #label>
13
- Company name <sup class="color-status-red-100">*</sup>
14
- </template>
15
- </VelBasic>
16
-
17
- <VelSelect
18
- v-if="method === 'patch'"
19
- v-model="form.primary_contact"
20
- name="primary_contact"
21
- :error="form.errors"
22
- placeholder="Primary Contact"
23
- label="Primary Contact"
24
- :options="
25
- users?.map(({ name, id }) => ({
26
- label: name,
27
- value: id,
28
- }))
29
- "
30
- />
31
-
32
- <hr class="my-3 hr-muted" />
33
-
34
- <p class="my-0">Domain/s <sup class="color-status-red-100">*</sup></p>
35
-
36
- <ul class="list-none pl-0 mt mb-2">
37
- <li
38
- v-for="(path, index) in form.domains"
39
- :key="index"
40
- class="mb-0.5"
41
- >
42
- <el-input
43
- v-model="form.domains[index]"
44
- placeholder="avalerehealth.com"
45
- >
46
- <template #prepend>@</template>
47
- <template #append>
48
- <VelButton
49
- type="danger"
50
- @click="form.domains.splice(index, 1)"
51
- >
52
- <GSvg class="vel-icon" name="icon-trash" />
53
- </VelButton>
54
- </template>
55
- </el-input>
56
-
57
- <small
58
- v-if="form.errors && form.errors.has(`domains.${index}`)"
59
- class="form__error vel-basic__error"
60
- v-text="form.errors.first(`domains.${index}`)"
61
- ></small>
62
- </li>
63
- </ul>
64
-
65
- <div>
66
- <VelButton @click="form.domains.push('')">
67
- Add Domain
68
-
69
- <GIcon
70
- name="icon-plus"
71
- embed
72
- asis
73
- class="fill-0 icon--0.5 ml"
74
- />
75
- </VelButton>
76
- </div>
77
-
78
- <VelBasic
79
- v-model="form.seats"
80
- name="seats"
81
- :error="form.errors"
82
- type="number"
83
- placeholder="Company seats"
84
- label="Company seats"
85
- min="0"
86
- class="mb-0 mt-2"
87
- >
88
- <template #label>
89
- Company seats <sup class="color-status-red-100">*</sup>
90
- </template>
91
- </VelBasic>
92
-
93
- <hr class="my-5 hr-muted" />
94
-
95
- <template v-if="$store.getters.can('edit roles')">
96
- <VelFormRole :form="form" />
97
-
98
- <hr class="my-5 hr-muted" />
99
- </template>
100
-
101
- <template v-if="$store.getters.can('edit sso')">
102
- <h3 class="h3 mb-2">SSO Settings</h3>
103
-
104
- <VelSelect
105
- v-model="form.sso_type"
106
- name="sso_type"
107
- :error="form.errors"
108
- placeholder="Please Select"
109
- label="Provider"
110
- clearable
111
- :options="[
112
- {
113
- value: 'azure',
114
- label: 'azure',
115
- },
116
- {
117
- value: 'google',
118
- label: 'google',
119
- },
120
- ]"
121
- />
122
- <VelBasic
123
- v-model="form.sso_client_id"
124
- name="sso_client_id"
125
- :error="form.errors"
126
- type="text"
127
- placeholder="Key"
128
- label="Key"
129
- />
130
- <VelBasic
131
- v-model="form.sso_tenant"
132
- name="sso_tenant"
133
- :error="form.errors"
134
- type="text"
135
- placeholder="Tenant"
136
- label="Tenant"
137
- />
138
- <VelBasic
139
- v-model="form.sso_client_secret"
140
- name="sso_client_secret"
141
- :error="form.errors"
142
- type="password"
143
- placeholder="Secret"
144
- label="Secret"
145
- />
146
-
147
- <hr class="my-3 hr-muted" />
148
- </template>
149
-
150
- <VelFormFooter :form="form" />
151
- </form>
152
- </template>
153
-
154
- <!-- eslint-disable vue/no-mutating-props -->
155
- <script>
156
- import axios from "axios";
157
- import VelButton from "../../../../components/basic/Button.vue";
158
- import VelSelect from "../../../../components/form/Select.vue";
159
- import VelBasic from "../../../../components/form/basic.vue";
160
- import VelFormRole from "../../../../components/layout/FormRole.vue";
161
- import VelFormFooter from "../../../../components/layout/FormFooter.vue";
162
- import { ElInput } from "element-plus";
163
-
164
- export default {
165
- components: {
166
- VelFormFooter,
167
- VelFormRole,
168
- VelButton,
169
- VelSelect,
170
- VelBasic,
171
- ElInput,
172
- },
173
-
174
- props: {
175
- form: {
176
- required: true,
177
- type: Object,
178
- },
179
- submit: {
180
- required: true,
181
- type: Function,
182
- },
183
- method: {
184
- type: String,
185
- default: "post",
186
- },
187
- },
188
-
189
- data() {
190
- return {
191
- users: [],
192
- };
193
- },
194
-
195
- mounted() {
196
- axios
197
- .getAll(
198
- `/api/users?filter[company_id]=${this.$route.params.companiesId}`,
199
- )
200
- .then((res) => {
201
- this.users = res.data.data;
202
- });
203
- },
204
- };
205
- </script>
@@ -1,193 +0,0 @@
1
- <!-- eslint-disable vue/no-mutating-props -->
2
- <template>
3
- <form class="" @submit.prevent="submit">
4
- <template v-if="method !== 'patch'">
5
- <VelBasic
6
- v-model="form.name"
7
- name="name"
8
- :error="form.errors"
9
- type="text"
10
- placeholder="Name"
11
- label="Name"
12
- />
13
-
14
- <VelBasic
15
- v-model="form.email"
16
- placeholder="Email"
17
- label="Email"
18
- type="text"
19
- name="email"
20
- :error="form.errors"
21
- />
22
-
23
- Company: <span v-text="company?.name" />
24
-
25
- <hr class="my-3 hr-muted" />
26
-
27
- <template v-if="isSSOCompany">
28
- <p class="mb-3">
29
- This user belongs to an SSO-enabled company. They
30
- will authenticate via SSO on first login. No
31
- password is required.
32
- </p>
33
- </template>
34
- <template v-else>
35
- <VelCheckbox
36
- v-model="form.notify_user"
37
- name="notify_user"
38
- :error="form.errors"
39
- label="Send email to notify user of account and password"
40
- />
41
- <VelCheckbox
42
- v-model="form.force_password_change"
43
- name="force_password_change"
44
- :error="form.errors"
45
- label="Force password change on first login"
46
- />
47
- <VelCheckbox
48
- v-model="form.set_password"
49
- name="set_password"
50
- :error="form.errors"
51
- label="Auto generate password"
52
- />
53
- <template v-if="!form.set_password">
54
- <VelBasic
55
- v-model="form.password"
56
- name="password"
57
- :error="form.errors"
58
- type="password"
59
- placeholder="Password"
60
- label="Password"
61
- />
62
- <VelBasic
63
- v-model="form.password_confirmation"
64
- name="password_confirmation"
65
- :error="form.errors"
66
- type="password"
67
- placeholder="Password Confirmation"
68
- label="Password Confirmation"
69
- />
70
- </template>
71
- </template>
72
-
73
- <hr class="my-5 hr-muted" />
74
- </template>
75
-
76
- <template v-if="$store.getters.can('edit roles')">
77
- <template v-if="enableRoles">
78
- <VelButton
79
- @click="
80
- form.roles = [];
81
- enableRoles = false;
82
- "
83
- >
84
- Reset roles
85
- </VelButton>
86
- <VelFormRole :form="form" />
87
- </template>
88
- <template v-else>
89
- <VelButton @click="enableRoles = true">
90
- <GIcon
91
- name="icon-plus"
92
- embed
93
- asis
94
- class="fill-0 icon--0.5 mr"
95
- />
96
- Override roles
97
- </VelButton>
98
- <p class="mt-2">
99
- Roles will be inherited from the company level.
100
- </p>
101
- </template>
102
- <hr class="my-5 hr-muted" />
103
- </template>
104
-
105
- <VelFormFooter :loading="form.processing" />
106
- </form>
107
- </template>
108
-
109
- <script>
110
- import axios from "axios";
111
- import { debounce } from "lodash";
112
- import VelButton from "../../../../components/basic/Button.vue";
113
- import VelCheckbox from "../../../../components/form/Checkbox.vue";
114
- import VelBasic from "../../../../components/form/basic.vue";
115
- import VelFormRole from "../../../../components/layout/FormRole.vue";
116
- import VelFormFooter from "../../../../components/layout/FormFooter.vue";
117
-
118
- export default {
119
- components: {
120
- VelFormFooter,
121
- VelFormRole,
122
- VelCheckbox,
123
- VelButton,
124
- VelBasic,
125
- },
126
- props: {
127
- form: {
128
- required: true,
129
- type: Object,
130
- },
131
- submit: {
132
- required: true,
133
- type: Function,
134
- },
135
- method: {
136
- type: String,
137
- default: "post",
138
- },
139
- },
140
-
141
- data() {
142
- return {
143
- companies: null,
144
- enableRoles: null,
145
- company: null,
146
- };
147
- },
148
-
149
- computed: {
150
- domain() {
151
- return this.form.email?.split("@")[1];
152
- },
153
- isSSOCompany() {
154
- return !!this.company?.sso_enabled;
155
- },
156
- },
157
-
158
- watch: {
159
- "form.roles": {
160
- handler(newVal) {
161
- if (this.enableRoles === null) {
162
- this.enableRoles = newVal.length > 0;
163
- }
164
- },
165
- },
166
- "form.email": debounce(function () {
167
- if (this.domain) {
168
- axios
169
- .get("/api/companies", {
170
- params: {
171
- "filter[domains.domain]": this.domain,
172
- },
173
- })
174
- .then((res) => {
175
- this.company = res.data.data[0];
176
- })
177
- .catch((error) => {
178
- console.error("Error fetching company:", error);
179
- this.company = null;
180
- });
181
- } else {
182
- this.company = null;
183
- }
184
- }, 500),
185
- },
186
-
187
- mounted() {
188
- axios.getAll("/api/companies").then((res) => {
189
- this.companies = res.data.data;
190
- });
191
- },
192
- };
193
- </script>