Skip to content

Commit

Permalink
v1.15.7
Browse files Browse the repository at this point in the history
  • Loading branch information
zackatbrightbeam committed Jul 12, 2024
1 parent b2ab322 commit 21fd008
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 31 deletions.
15 changes: 7 additions & 8 deletions dist/voxgig-model-react.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -45915,6 +45915,7 @@ function BasicList(props) {
var _a, _b;
const {
ctx,
key,
onRowClick = () => {
},
onEditingRowSave = () => {
Expand All @@ -45930,7 +45931,6 @@ function BasicList(props) {
const theme = ctx().theme;
const editingMode = ((_a = spec.content.def.subview[action]) == null ? void 0 : _a.editingMode) || "none";
const enableColumnFilters = ((_b = spec.content.def.subview[action]) == null ? void 0 : _b.enableColumnFilters) || false;
const cmpKey = spec.content.key;
const handleSaveRow = (_0) => __async(this, [_0], function* ({ exitEditingMode, row, values: values2 }) {
onEditingRowSave(row, values2);
exitEditingMode();
Expand Down Expand Up @@ -45977,7 +45977,7 @@ function BasicList(props) {
MaterialReactTable,
__spreadProps(__spreadValues(__spreadValues({}, commonTableProps), specificProps), {
state: { isLoading },
key: cmpKey
key
})
) }) });
}
Expand Down Expand Up @@ -49282,15 +49282,14 @@ function BasicLed(props) {
const { ctx, action } = props;
const { seneca, custom } = ctx();
const [item, setItem] = useState({});
const location2 = useLocation();
const navigate = useNavigate();
const [data, setData] = useState([]);
const [isLoading, setIsLoading] = useState(false);
let [triggerLed, setTriggerLed] = useState(0);
const location2 = useLocation();
const navigate = useNavigate();
const basicLedSpec = BasicLedSpecShape(props.spec);
const viewName = basicLedSpec.name;
const def = basicLedSpec.content.def;
const canon = def.canon;
const canon = basicLedSpec.content.def.canon;
const fields = basicLedSpec.content.def.field;
const cmpState = useSelector((state) => state.main.vxg.cmp);
const entState = useSelector(
Expand Down Expand Up @@ -49357,7 +49356,7 @@ function BasicLed(props) {
}, [location2.pathname]);
useEffect(() => {
if (triggerLed >= 2) {
setItem({ entity$: "-/" + def.canon });
setItem({ entity$: "-/" + canon });
}
setTriggerLed(++triggerLed);
}, [led_add]);
Expand Down Expand Up @@ -49535,7 +49534,7 @@ function BasicLed(props) {
setItem({});
})
},
canon
basicLedSpec.name
),
FootCmp ? /* @__PURE__ */ jsxRuntimeExports.jsx(FootCmp, { ctx }) : null
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
Expand Down
15 changes: 7 additions & 8 deletions dist/voxgig-model-react.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -45927,6 +45927,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
var _a, _b;
const {
ctx,
key,
onRowClick = () => {
},
onEditingRowSave = () => {
Expand All @@ -45942,7 +45943,6 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
const theme = ctx().theme;
const editingMode = ((_a = spec.content.def.subview[action]) == null ? void 0 : _a.editingMode) || "none";
const enableColumnFilters = ((_b = spec.content.def.subview[action]) == null ? void 0 : _b.enableColumnFilters) || false;
const cmpKey = spec.content.key;
const handleSaveRow = (_0) => __async(this, [_0], function* ({ exitEditingMode, row, values: values2 }) {
onEditingRowSave(row, values2);
exitEditingMode();
Expand Down Expand Up @@ -45989,7 +45989,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
MaterialReactTable,
__spreadProps(__spreadValues(__spreadValues({}, commonTableProps), specificProps), {
state: { isLoading },
key: cmpKey
key
})
) }) });
}
Expand Down Expand Up @@ -49294,15 +49294,14 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
const { ctx, action } = props;
const { seneca, custom } = ctx();
const [item, setItem] = React.useState({});
const location2 = reactRouterDom.useLocation();
const navigate = reactRouterDom.useNavigate();
const [data, setData] = React.useState([]);
const [isLoading, setIsLoading] = React.useState(false);
let [triggerLed, setTriggerLed] = React.useState(0);
const location2 = reactRouterDom.useLocation();
const navigate = reactRouterDom.useNavigate();
const basicLedSpec = BasicLedSpecShape(props.spec);
const viewName = basicLedSpec.name;
const def = basicLedSpec.content.def;
const canon = def.canon;
const canon = basicLedSpec.content.def.canon;
const fields = basicLedSpec.content.def.field;
const cmpState = reactRedux.useSelector((state) => state.main.vxg.cmp);
const entState = reactRedux.useSelector(
Expand Down Expand Up @@ -49369,7 +49368,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
}, [location2.pathname]);
React.useEffect(() => {
if (triggerLed >= 2) {
setItem({ entity$: "-/" + def.canon });
setItem({ entity$: "-/" + canon });
}
setTriggerLed(++triggerLed);
}, [led_add]);
Expand Down Expand Up @@ -49547,7 +49546,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${key}Cha
setItem({});
})
},
canon
basicLedSpec.name
),
FootCmp ? /* @__PURE__ */ jsxRuntimeExports.jsx(FootCmp, { ctx }) : null
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@voxgig/model-react",
"version": "1.15.6",
"version": "1.15.7",
"license": "MIT",
"files": [
"dist"
Expand Down
23 changes: 11 additions & 12 deletions src/lib/BasicLed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,30 @@ const BasicLedSpecShape = Gubu({
function BasicLed(props: any) {
const { ctx, action } = props
const { seneca, custom } = ctx()

const [item, setItem] = useState({} as any)
const location = useLocation()
const navigate = useNavigate()
const [data, setData] = useState([] as any)
const [isLoading, setIsLoading] = useState(false)
let [triggerLed, setTriggerLed] = useState(0)

// define variables from spec
const location = useLocation()
const navigate = useNavigate()

// Define variables from spec
const basicLedSpec = BasicLedSpecShape(props.spec)
const viewName = basicLedSpec.name
const def = basicLedSpec.content.def
const canon = def.canon
const canon = basicLedSpec.content.def.canon
const fields: any = basicLedSpec.content.def.field

// ----- Define variables from state -----
const cmpState = useSelector((state: any) => state.main.vxg.cmp)

// Move the useSelector hook to the top level of your component
const entState = useSelector(
(state: any) => state.main.vxg.ent.meta.main[canon].state
)

// Define data we'll use to render the list
// ----- Define variables from state -----
const entlist = useSelector(
(state: any) => state.main.vxg.ent.list.main[canon]
)
Expand All @@ -71,9 +73,8 @@ function BasicLed(props: any) {

// Handle when the add button (in BasicHead) is clicked
const led_add = useSelector((state: any) => state.main.vxg.trigger.led.add)
// const vxgState = useSelector((state: any) => state.main.vxg)
// const led_add = vxgState.trigger.led.add

// ----- Define useEffect hooks -----
useEffect(() => {
if ('none' === entState) {
setIsLoading(true)
Expand Down Expand Up @@ -143,14 +144,12 @@ function BasicLed(props: any) {
useEffect(() => {
// a workaround to prevent 'useEffect' to trigger when re-rendered
if (triggerLed >= 2) {
setItem({ entity$: '-/' + def.canon })
setItem({ entity$: '-/' + canon })
}

setTriggerLed(++triggerLed)
}, [led_add])

// console.log('BasicLed', 'fields', Object.entries(fields))

// TODO: move to BasicList
// Define BasicList columns from fields
const basicListColumns = Object.entries(fields).map(
Expand Down Expand Up @@ -357,7 +356,7 @@ function BasicLed(props: any) {
<>
{HeadCmp ? <HeadCmp ctx={ctx} /> : null}
<BasicList
key={canon}
key={basicLedSpec.name}
ctx={ctx}
spec={basicLedSpec}
data={data || []}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/BasicList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Box } from '@mui/material'
function BasicList(props: any) {
const {
ctx,
key,
onRowClick = () => {},
onEditingRowSave = () => {},
data,
Expand All @@ -28,7 +29,6 @@ function BasicList(props: any) {
const editingMode = spec.content.def.subview[action]?.editingMode || 'none'
const enableColumnFilters =
spec.content.def.subview[action]?.enableColumnFilters || false
const cmpKey = spec.content.key

// callbacks for MaterialReactTable
const handleSaveRow: MaterialReactTableProps<any>['onEditingRowSave'] =
Expand Down Expand Up @@ -86,7 +86,7 @@ function BasicList(props: any) {
{...commonTableProps}
{...specificProps}
state={{ isLoading: isLoading }}
key={cmpKey}
key={key}
/>
</Box>
</ThemeProvider>
Expand Down

0 comments on commit 21fd008

Please sign in to comment.