admin_lsac 2.0.26 → 2.0.27

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/README.md CHANGED
@@ -150,7 +150,7 @@ import { PageSchema } from '../schema';
150
150
 
151
151
  const domain = 'http://localhost:3001';
152
152
 
153
- // Please try to modularize the code for a schema though
153
+ // Please try to modularize the code for your schemas though
154
154
 
155
155
  export const coursesPage: PageSchema = {
156
156
  name: 'Courses',
@@ -231,6 +231,7 @@ export const coursesPage: PageSchema = {
231
231
  label: 'Level',
232
232
  type: 'dropdown',
233
233
  validationSchema: Yup.string().required('Level is required'),
234
+ // 'options' would have the same effect as 'getOptions', but not written as a function
234
235
  getOptions: async () => [
235
236
  { value: 'Undergraduate', display: 'Undergraduate' },
236
237
  { value: 'Graduate', display: 'Graduate' },
@@ -22,9 +22,10 @@ function generateSingleField(formfield, fieldName, key) {
22
22
  form.setFieldValue(fieldName, event.currentTarget.files[0]);
23
23
  }
24
24
  } })) : (_jsxs(Select, { ...field, value: field.value || '', onChange: (e) => {
25
- const selectedOption = formfield.options?.[parseInt(e.target.value)];
26
- form.setFieldValue(fieldName, selectedOption?.value);
27
- }, children: [_jsx("option", { disabled: true, value: "", children: "Select an option!" }), formfield.options?.map((option, key) => (_jsx("option", { value: key, children: option.display }, key)))] })), _jsx(FormErrorMessage, { children: getIn(form.errors, fieldName) })] })) }, key));
25
+ const rawValue = e.target.value;
26
+ const matchedOption = formfield.options?.find((opt) => String(opt.value) === rawValue);
27
+ form.setFieldValue(fieldName, matchedOption?.value);
28
+ }, children: [_jsx("option", { disabled: true, value: "", children: "Select an option!" }), formfield.options?.map((option, key) => (_jsx("option", { value: String(option.value), children: option.display }, key)))] })), _jsx(FormErrorMessage, { children: getIn(form.errors, fieldName) })] })) }, key));
28
29
  }
29
30
  function parseFields(fields, previous) {
30
31
  if (!fields) {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import axios from 'axios';
3
3
  import * as Yup from 'yup';
4
4
  const domain = 'http://localhost:3001';
5
- // Please try to modularize the code for a schema though
5
+ // Please try to modularize the code for your schemas though
6
6
  export const coursesPage = {
7
7
  name: 'Courses',
8
8
  // 1. Data retrieval: fetch all courses from backend
@@ -77,6 +77,7 @@ export const coursesPage = {
77
77
  label: 'Level',
78
78
  type: 'dropdown',
79
79
  validationSchema: Yup.string().required('Level is required'),
80
+ // 'options' would have the same effect as 'getOptions', but not written as a function
80
81
  getOptions: async () => [
81
82
  { value: 'Undergraduate', display: 'Undergraduate' },
82
83
  { value: 'Graduate', display: 'Graduate' },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "admin_lsac",
3
3
  "private": false,
4
- "version": "2.0.26",
4
+ "version": "2.0.27",
5
5
  "description": "Generic Admin Panel created for storing events' data",
6
6
  "scripts": {
7
7
  "dev": "vite",