@erpsquad/common 1.10.77 → 1.10.78
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/dist/chunks/{android-12-switch-CoMylrig.js → android-12-switch-1bs0RMnV.js} +288 -228
- package/dist/chunks/{android-12-switch-CoMylrig.js.map → android-12-switch-1bs0RMnV.js.map} +1 -1
- package/dist/chunks/{android-12-switch-CJmu5zpr.esm.js → android-12-switch-BQHaGZz6.esm.js} +288 -228
- package/dist/chunks/{android-12-switch-CJmu5zpr.esm.js.map → android-12-switch-BQHaGZz6.esm.js.map} +1 -1
- package/dist/chunks/{default-data-C_eEc8KO.js → default-data-BLwWZjhM.js} +2 -2
- package/dist/chunks/{default-data-C_eEc8KO.js.map → default-data-BLwWZjhM.js.map} +1 -1
- package/dist/chunks/{default-data-Bhdk8Rkn.esm.js → default-data-DzOhtrxC.esm.js} +2 -2
- package/dist/chunks/{default-data-Bhdk8Rkn.esm.js.map → default-data-DzOhtrxC.esm.js.map} +1 -1
- package/dist/chunks/{uom-field-wrapper-BmRhzpUZ.js → uom-field-wrapper-Bdou6Bjq.js} +2 -2
- package/dist/chunks/{uom-field-wrapper-BmRhzpUZ.js.map → uom-field-wrapper-Bdou6Bjq.js.map} +1 -1
- package/dist/chunks/{uom-field-wrapper-GQYKNbtK.esm.js → uom-field-wrapper-swTpN914.esm.js} +2 -2
- package/dist/chunks/{uom-field-wrapper-GQYKNbtK.esm.js.map → uom-field-wrapper-swTpN914.esm.js.map} +1 -1
- package/dist/components/index.esm.js +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/material-table/components/inline-edit-fields.d.ts +9 -9
- package/dist/index.esm.js +3 -3
- package/dist/index.js +3 -3
- package/dist/src/components/material-table/components/inline-edit-fields.d.ts +9 -9
- package/dist/views/index.esm.js +3 -3
- package/dist/views/index.js +2 -2
- package/package.json +1 -1
|
@@ -27598,253 +27598,310 @@ const UploadMedia = memo((props) => {
|
|
|
27598
27598
|
getSelectedFiles(value)
|
|
27599
27599
|
] });
|
|
27600
27600
|
});
|
|
27601
|
+
const EMPTY_EDIT_PROPERTIES = Object.freeze({});
|
|
27602
|
+
const CACHE_NORMALISED = Symbol.for("erpsquad.inlineEdit.cacheNormalised");
|
|
27603
|
+
const isCacheNormalised = (cache) => Boolean(cache && cache[CACHE_NORMALISED]);
|
|
27604
|
+
const markCacheNormalised = (cache) => {
|
|
27605
|
+
cache[CACHE_NORMALISED] = true;
|
|
27606
|
+
return cache;
|
|
27607
|
+
};
|
|
27608
|
+
const isBlank = (value) => value === void 0 || value === null || value === "";
|
|
27609
|
+
const shallowEqual = (a = {}, b = {}) => {
|
|
27610
|
+
if (a === b) return true;
|
|
27611
|
+
const aKeys = Object.keys(a);
|
|
27612
|
+
const bKeys = Object.keys(b);
|
|
27613
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
27614
|
+
return aKeys.every((key) => Object.is(a[key], b[key]));
|
|
27615
|
+
};
|
|
27616
|
+
const rowSubscribers = /* @__PURE__ */ new Map();
|
|
27617
|
+
const subscribeToRow = (rowId, listener) => {
|
|
27618
|
+
let listeners = rowSubscribers.get(rowId);
|
|
27619
|
+
if (!listeners) {
|
|
27620
|
+
listeners = /* @__PURE__ */ new Set();
|
|
27621
|
+
rowSubscribers.set(rowId, listeners);
|
|
27622
|
+
}
|
|
27623
|
+
listeners.add(listener);
|
|
27624
|
+
return () => {
|
|
27625
|
+
listeners == null ? void 0 : listeners.delete(listener);
|
|
27626
|
+
if (listeners && listeners.size === 0) rowSubscribers.delete(rowId);
|
|
27627
|
+
};
|
|
27628
|
+
};
|
|
27629
|
+
const publishRowCache = (rowId, cache) => {
|
|
27630
|
+
var _a;
|
|
27631
|
+
(_a = rowSubscribers.get(rowId)) == null ? void 0 : _a.forEach((listener) => listener(cache));
|
|
27632
|
+
};
|
|
27633
|
+
const readInitialValue = (mrtColumn, row) => {
|
|
27634
|
+
var _a;
|
|
27635
|
+
const columnDef = (mrtColumn == null ? void 0 : mrtColumn.columnDef) ?? {};
|
|
27636
|
+
const columnId = mrtColumn == null ? void 0 : mrtColumn.id;
|
|
27637
|
+
const {
|
|
27638
|
+
valueKey,
|
|
27639
|
+
is_multiple: isMultiple,
|
|
27640
|
+
defaultValue
|
|
27641
|
+
} = columnDef.editProperties ?? EMPTY_EDIT_PROPERTIES;
|
|
27642
|
+
const variant = columnDef.editVariant;
|
|
27643
|
+
const accessorValue = (_a = row == null ? void 0 : row.original) == null ? void 0 : _a[columnId];
|
|
27644
|
+
const boundValue = valueKey ? _.get(row == null ? void 0 : row.original, valueKey) : accessorValue;
|
|
27645
|
+
const accessorIsSafeFallback = !valueKey || valueKey === columnId;
|
|
27646
|
+
const rawValue = boundValue !== void 0 ? boundValue : accessorIsSafeFallback ? accessorValue : void 0;
|
|
27647
|
+
if (variant === "select" && isMultiple) {
|
|
27648
|
+
if (isBlank(boundValue)) return defaultValue ?? [];
|
|
27649
|
+
return Array.isArray(boundValue) ? boundValue : [boundValue];
|
|
27650
|
+
}
|
|
27651
|
+
if (variant === "date" || variant === "date_time") {
|
|
27652
|
+
const dateSource = boundValue !== void 0 ? boundValue : accessorValue;
|
|
27653
|
+
if (isBlank(dateSource)) return void 0;
|
|
27654
|
+
return dayjs(dateSource).isValid() ? dayjs(dateSource) : void 0;
|
|
27655
|
+
}
|
|
27656
|
+
if (variant === "select") {
|
|
27657
|
+
return isBlank(boundValue) ? defaultValue ?? "" : boundValue;
|
|
27658
|
+
}
|
|
27659
|
+
if (variant === "checkbox") {
|
|
27660
|
+
return isBlank(rawValue) ? Boolean(defaultValue) : Boolean(rawValue);
|
|
27661
|
+
}
|
|
27662
|
+
return isBlank(rawValue) && defaultValue !== void 0 ? defaultValue : rawValue;
|
|
27663
|
+
};
|
|
27664
|
+
const buildInitialCache = (row) => {
|
|
27665
|
+
const cache = {};
|
|
27666
|
+
row.getAllCells().forEach((cell) => {
|
|
27667
|
+
var _a;
|
|
27668
|
+
const enableEditing = (_a = cell.column.columnDef) == null ? void 0 : _a.enableEditing;
|
|
27669
|
+
if (enableEditing === void 0 || enableEditing === true) {
|
|
27670
|
+
cache[cell.column.id] = readInitialValue(cell.column, row);
|
|
27671
|
+
}
|
|
27672
|
+
});
|
|
27673
|
+
return markCacheNormalised(cache);
|
|
27674
|
+
};
|
|
27675
|
+
const extractValue = (event, type) => {
|
|
27676
|
+
var _a;
|
|
27677
|
+
switch (type) {
|
|
27678
|
+
case "date":
|
|
27679
|
+
case "file":
|
|
27680
|
+
case "image":
|
|
27681
|
+
case "phone":
|
|
27682
|
+
return event;
|
|
27683
|
+
case "checkbox":
|
|
27684
|
+
return (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.checked;
|
|
27685
|
+
default:
|
|
27686
|
+
return (event == null ? void 0 : event.target) ? event.target.value : event;
|
|
27687
|
+
}
|
|
27688
|
+
};
|
|
27601
27689
|
const InlineEditFields = ({
|
|
27602
|
-
// cell,
|
|
27603
27690
|
column,
|
|
27604
27691
|
row,
|
|
27605
|
-
// table,
|
|
27606
27692
|
col,
|
|
27607
|
-
// callback,
|
|
27608
27693
|
errors,
|
|
27609
27694
|
validationSchema: validationSchema2,
|
|
27610
27695
|
setValidationErrors,
|
|
27611
27696
|
onChangeRowField,
|
|
27612
27697
|
getSelectedData
|
|
27613
27698
|
}) => {
|
|
27614
|
-
var _a
|
|
27615
|
-
const [
|
|
27616
|
-
const [
|
|
27617
|
-
const
|
|
27618
|
-
const
|
|
27619
|
-
|
|
27699
|
+
var _a;
|
|
27700
|
+
const [values, setValues] = useState(() => (row == null ? void 0 : row._valuesCache) ?? {});
|
|
27701
|
+
const [customFilter, setCustomFilter] = useState(null);
|
|
27702
|
+
const editVariant = col == null ? void 0 : col.editVariant;
|
|
27703
|
+
const fieldProperties = ((_a = column.columnDef) == null ? void 0 : _a.editProperties) ?? EMPTY_EDIT_PROPERTIES;
|
|
27704
|
+
const columnId = column.id;
|
|
27705
|
+
const rowId = row.id;
|
|
27706
|
+
useEffect(
|
|
27707
|
+
() => subscribeToRow(rowId, (cache) => {
|
|
27708
|
+
setValues((prev) => shallowEqual(prev, cache) ? prev : cache);
|
|
27709
|
+
}),
|
|
27710
|
+
[rowId]
|
|
27620
27711
|
);
|
|
27621
|
-
const editVariant = col.editVariant;
|
|
27622
|
-
const fieldProperties = ((_a = column.columnDef) == null ? void 0 : _a.editProperties) || {};
|
|
27623
|
-
let fieldDisbled = false;
|
|
27624
|
-
if (fieldProperties == null ? void 0 : fieldProperties.disable) {
|
|
27625
|
-
if (typeof fieldProperties.disable === "function") {
|
|
27626
|
-
fieldDisbled = Boolean(fieldProperties == null ? void 0 : fieldProperties.disable(row, row._valuesCache));
|
|
27627
|
-
} else {
|
|
27628
|
-
fieldDisbled = Boolean(fieldProperties.disable);
|
|
27629
|
-
}
|
|
27630
|
-
}
|
|
27631
|
-
const handleCustomFilter = useCallback(async (row2, values) => {
|
|
27632
|
-
try {
|
|
27633
|
-
if (typeof fieldProperties.customeFilter === "function") {
|
|
27634
|
-
const filter = await fieldProperties.customeFilter(row2, values);
|
|
27635
|
-
customFilter.current = filter;
|
|
27636
|
-
return filter;
|
|
27637
|
-
} else {
|
|
27638
|
-
customFilter.current = fieldProperties == null ? void 0 : fieldProperties.customeFilter;
|
|
27639
|
-
}
|
|
27640
|
-
} catch (error) {
|
|
27641
|
-
return null;
|
|
27642
|
-
}
|
|
27643
|
-
}, [fieldProperties, row, row._valuesCache]);
|
|
27644
27712
|
useEffect(() => {
|
|
27645
|
-
|
|
27646
|
-
|
|
27647
|
-
|
|
27648
|
-
|
|
27649
|
-
if (editVariant === "select" && (fieldProperties == null ? void 0 : fieldProperties.is_multiple)) {
|
|
27650
|
-
defaultValue = valueKey ? _.get(row.original, valueKey, []) : [];
|
|
27651
|
-
} else {
|
|
27652
|
-
defaultValue = valueKey ? _.get(row.original, valueKey, row.original[column.id]) : row.original[column.id];
|
|
27653
|
-
}
|
|
27654
|
-
const validate = async (value) => {
|
|
27655
|
-
try {
|
|
27656
|
-
await validationSchema2.validateAt(
|
|
27657
|
-
column.id,
|
|
27658
|
-
{
|
|
27659
|
-
[column.id]: value
|
|
27660
|
-
},
|
|
27661
|
-
{
|
|
27662
|
-
abortEarly: false
|
|
27663
|
-
}
|
|
27664
|
-
);
|
|
27665
|
-
const fe = {};
|
|
27666
|
-
for (const e in errors) {
|
|
27667
|
-
if (e != column.id) {
|
|
27668
|
-
fe[e] = errors[e];
|
|
27669
|
-
}
|
|
27670
|
-
}
|
|
27671
|
-
setValidationErrors(fe);
|
|
27672
|
-
} catch (err) {
|
|
27673
|
-
if (err instanceof Yup.ValidationError) {
|
|
27674
|
-
const e = {};
|
|
27675
|
-
err.inner.forEach((error) => {
|
|
27676
|
-
if (error.path) {
|
|
27677
|
-
e[error.path] = error.message;
|
|
27678
|
-
}
|
|
27679
|
-
});
|
|
27680
|
-
const em = { ...errors, ...e };
|
|
27681
|
-
setValidationErrors(em);
|
|
27682
|
-
}
|
|
27683
|
-
}
|
|
27684
|
-
};
|
|
27685
|
-
const onChange = async (e, type, selectedData) => {
|
|
27686
|
-
const data = selectedData;
|
|
27687
|
-
let value;
|
|
27688
|
-
switch (type) {
|
|
27689
|
-
case "date":
|
|
27690
|
-
case "file":
|
|
27691
|
-
case "image":
|
|
27692
|
-
case "phone":
|
|
27693
|
-
value = e;
|
|
27694
|
-
break;
|
|
27695
|
-
case "text":
|
|
27696
|
-
case "number":
|
|
27697
|
-
value = e.target.value;
|
|
27698
|
-
break;
|
|
27699
|
-
case "checkbox":
|
|
27700
|
-
value = e.target.checked;
|
|
27701
|
-
break;
|
|
27702
|
-
default:
|
|
27703
|
-
value = e.target.value;
|
|
27704
|
-
break;
|
|
27705
|
-
}
|
|
27706
|
-
setInputValue({ ...inputValue, [column.id]: value });
|
|
27707
|
-
if (onChangeRowField) {
|
|
27708
|
-
const v = await onChangeRowField(e, type, row, col, data);
|
|
27709
|
-
if (v) {
|
|
27710
|
-
row._valuesCache = { ...row._valuesCache, ...v };
|
|
27711
|
-
}
|
|
27713
|
+
const existing = row._valuesCache;
|
|
27714
|
+
if (isCacheNormalised(existing)) {
|
|
27715
|
+
setValues(existing);
|
|
27716
|
+
return;
|
|
27712
27717
|
}
|
|
27713
|
-
|
|
27714
|
-
|
|
27715
|
-
|
|
27716
|
-
|
|
27717
|
-
|
|
27718
|
-
|
|
27719
|
-
useEffect(() => {
|
|
27720
|
-
setInputValue({ ...inputValue, ...row._valuesCache });
|
|
27721
|
-
}, [row._valuesCache]);
|
|
27718
|
+
const seeded = buildInitialCache(row);
|
|
27719
|
+
row._valuesCache = seeded;
|
|
27720
|
+
setValues(seeded);
|
|
27721
|
+
publishRowCache(rowId, seeded);
|
|
27722
|
+
}, [rowId]);
|
|
27723
|
+
const rawCustomFilter = fieldProperties.customeFilter;
|
|
27722
27724
|
useEffect(() => {
|
|
27723
|
-
|
|
27724
|
-
|
|
27725
|
-
|
|
27725
|
+
if (editVariant !== "select" || rawCustomFilter === void 0) return;
|
|
27726
|
+
if (typeof rawCustomFilter !== "function") {
|
|
27727
|
+
setCustomFilter(rawCustomFilter ?? null);
|
|
27728
|
+
return;
|
|
27729
|
+
}
|
|
27730
|
+
let cancelled = false;
|
|
27731
|
+
(async () => {
|
|
27732
|
+
try {
|
|
27733
|
+
const filter = await rawCustomFilter(row, row._valuesCache);
|
|
27734
|
+
if (!cancelled) setCustomFilter(filter ?? null);
|
|
27735
|
+
} catch {
|
|
27736
|
+
if (!cancelled) setCustomFilter(null);
|
|
27726
27737
|
}
|
|
27738
|
+
})();
|
|
27739
|
+
return () => {
|
|
27740
|
+
cancelled = true;
|
|
27727
27741
|
};
|
|
27728
|
-
|
|
27729
|
-
|
|
27730
|
-
|
|
27731
|
-
|
|
27732
|
-
|
|
27733
|
-
|
|
27734
|
-
|
|
27735
|
-
|
|
27736
|
-
|
|
27737
|
-
|
|
27738
|
-
|
|
27739
|
-
|
|
27740
|
-
|
|
27741
|
-
|
|
27742
|
-
|
|
27743
|
-
|
|
27744
|
-
|
|
27745
|
-
|
|
27746
|
-
|
|
27747
|
-
|
|
27748
|
-
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
|
|
27754
|
-
|
|
27755
|
-
|
|
27756
|
-
|
|
27757
|
-
|
|
27758
|
-
|
|
27759
|
-
|
|
27742
|
+
}, [rawCustomFilter, editVariant, row, values]);
|
|
27743
|
+
const isFieldDisabled = useMemo(() => {
|
|
27744
|
+
const { disable } = fieldProperties;
|
|
27745
|
+
if (typeof disable === "function") {
|
|
27746
|
+
return Boolean(disable(row, row._valuesCache));
|
|
27747
|
+
}
|
|
27748
|
+
return Boolean(disable);
|
|
27749
|
+
}, [fieldProperties, row, values]);
|
|
27750
|
+
const shouldAutoFocus = useMemo(() => {
|
|
27751
|
+
const firstEditable = row.getAllCells().map((cell) => cell.column.columnDef).find(
|
|
27752
|
+
(def) => (def == null ? void 0 : def.enableEditing) === void 0 || (def == null ? void 0 : def.enableEditing) === true
|
|
27753
|
+
);
|
|
27754
|
+
return (firstEditable == null ? void 0 : firstEditable.accessorKey) === columnId;
|
|
27755
|
+
}, [row, columnId]);
|
|
27756
|
+
const columnDefaultValue = useMemo(
|
|
27757
|
+
() => readInitialValue(column, row),
|
|
27758
|
+
[column, row]
|
|
27759
|
+
);
|
|
27760
|
+
const currentValue = (values == null ? void 0 : values[columnId]) !== void 0 ? values[columnId] : columnDefaultValue;
|
|
27761
|
+
const dateValue = useMemo(() => {
|
|
27762
|
+
if (isBlank(currentValue)) return void 0;
|
|
27763
|
+
return dayjs(currentValue).isValid() ? dayjs(currentValue) : void 0;
|
|
27764
|
+
}, [currentValue]);
|
|
27765
|
+
const fieldError = errors == null ? void 0 : errors[columnId];
|
|
27766
|
+
const validate = useCallback(
|
|
27767
|
+
async (value) => {
|
|
27768
|
+
if (!validationSchema2) return;
|
|
27769
|
+
try {
|
|
27770
|
+
await validationSchema2.validateAt(
|
|
27771
|
+
columnId,
|
|
27772
|
+
{ [columnId]: value },
|
|
27773
|
+
{ abortEarly: false }
|
|
27774
|
+
);
|
|
27775
|
+
setValidationErrors((prev) => {
|
|
27776
|
+
if (!prev || prev[columnId] === void 0) return prev ?? {};
|
|
27777
|
+
const next = { ...prev };
|
|
27778
|
+
delete next[columnId];
|
|
27779
|
+
return next;
|
|
27780
|
+
});
|
|
27781
|
+
} catch (err) {
|
|
27782
|
+
if (err instanceof Yup.ValidationError) {
|
|
27783
|
+
const fieldErrors = {};
|
|
27784
|
+
err.inner.forEach((error) => {
|
|
27785
|
+
if (error.path) fieldErrors[error.path] = error.message;
|
|
27786
|
+
});
|
|
27787
|
+
if (!err.inner.length && err.path) {
|
|
27788
|
+
fieldErrors[err.path] = err.message;
|
|
27760
27789
|
}
|
|
27790
|
+
setValidationErrors((prev) => ({ ...prev ?? {}, ...fieldErrors }));
|
|
27761
27791
|
}
|
|
27762
|
-
}
|
|
27763
|
-
|
|
27764
|
-
|
|
27765
|
-
|
|
27766
|
-
|
|
27767
|
-
|
|
27768
|
-
|
|
27769
|
-
|
|
27770
|
-
|
|
27792
|
+
}
|
|
27793
|
+
},
|
|
27794
|
+
[columnId, setValidationErrors, validationSchema2]
|
|
27795
|
+
);
|
|
27796
|
+
const handleChange = useCallback(
|
|
27797
|
+
async (event, type, selectedData) => {
|
|
27798
|
+
const value = extractValue(event, type);
|
|
27799
|
+
const optimistic = { ...row._valuesCache ?? {}, [columnId]: value };
|
|
27800
|
+
row._valuesCache = optimistic;
|
|
27801
|
+
setValues(optimistic);
|
|
27802
|
+
publishRowCache(rowId, optimistic);
|
|
27803
|
+
if (onChangeRowField) {
|
|
27804
|
+
const patch = await onChangeRowField(event, type, row, col, selectedData);
|
|
27805
|
+
if (patch) {
|
|
27806
|
+
const merged = { ...row._valuesCache, ...patch, [columnId]: value };
|
|
27807
|
+
row._valuesCache = merged;
|
|
27808
|
+
setValues(merged);
|
|
27809
|
+
publishRowCache(rowId, merged);
|
|
27810
|
+
}
|
|
27811
|
+
}
|
|
27812
|
+
await validate(value);
|
|
27813
|
+
},
|
|
27814
|
+
[col, columnId, onChangeRowField, row, rowId, validate]
|
|
27815
|
+
);
|
|
27816
|
+
const resolveDateBoundary = useCallback(
|
|
27817
|
+
(boundary) => typeof boundary === "function" ? boundary(row) : boundary,
|
|
27818
|
+
[row]
|
|
27819
|
+
);
|
|
27820
|
+
if (!editVariant || editVariant === "number") {
|
|
27821
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27771
27822
|
TextField$2,
|
|
27772
27823
|
{
|
|
27773
|
-
defaultValue,
|
|
27774
|
-
onChange: (e) =>
|
|
27775
|
-
value:
|
|
27776
|
-
autoFocus:
|
|
27824
|
+
defaultValue: columnDefaultValue,
|
|
27825
|
+
onChange: (e) => handleChange(e, editVariant),
|
|
27826
|
+
value: currentValue ?? "",
|
|
27827
|
+
autoFocus: shouldAutoFocus,
|
|
27777
27828
|
type: editVariant || "text",
|
|
27778
|
-
error: (
|
|
27779
|
-
helperText:
|
|
27829
|
+
error: Boolean(fieldError),
|
|
27830
|
+
helperText: fieldError,
|
|
27780
27831
|
placeholder: (fieldProperties == null ? void 0 : fieldProperties.placeholder) || "",
|
|
27781
27832
|
name: (fieldProperties == null ? void 0 : fieldProperties.field_name) || "",
|
|
27782
|
-
disabled:
|
|
27833
|
+
disabled: isFieldDisabled
|
|
27783
27834
|
}
|
|
27784
|
-
)
|
|
27785
|
-
|
|
27835
|
+
);
|
|
27836
|
+
}
|
|
27837
|
+
if (editVariant === "select") {
|
|
27838
|
+
const isMultiple = Boolean(fieldProperties == null ? void 0 : fieldProperties.is_multiple);
|
|
27839
|
+
const selectValue = isMultiple ? Array.isArray(currentValue) ? currentValue : [] : currentValue ?? "";
|
|
27840
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "column", width: "100%", children: [
|
|
27786
27841
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27787
27842
|
SearchableSelect,
|
|
27788
27843
|
{
|
|
27789
27844
|
name: (fieldProperties == null ? void 0 : fieldProperties.field_name) || "",
|
|
27790
|
-
defaultValue,
|
|
27845
|
+
defaultValue: columnDefaultValue,
|
|
27791
27846
|
placeholder: (fieldProperties == null ? void 0 : fieldProperties.placeholder) || "",
|
|
27792
|
-
searchPlaceholder: `Search ${col.header}`,
|
|
27793
|
-
onChange: (e,
|
|
27847
|
+
searchPlaceholder: `Search ${(col == null ? void 0 : col.header) ?? ""}`,
|
|
27848
|
+
onChange: (e, selectedRow) => handleChange(e, "select", selectedRow),
|
|
27794
27849
|
apiType: fieldProperties == null ? void 0 : fieldProperties.apiType,
|
|
27795
|
-
autoFocus:
|
|
27850
|
+
autoFocus: shouldAutoFocus,
|
|
27796
27851
|
options: col == null ? void 0 : col.editSelectOptions,
|
|
27797
|
-
customeFilter: customFilter
|
|
27852
|
+
customeFilter: customFilter,
|
|
27798
27853
|
filterKey: fieldProperties == null ? void 0 : fieldProperties.filterKey,
|
|
27799
27854
|
labelKey: fieldProperties == null ? void 0 : fieldProperties.labelKey,
|
|
27800
27855
|
valueKey: fieldProperties == null ? void 0 : fieldProperties.bindingKey,
|
|
27801
|
-
attributes: fieldProperties.attributes,
|
|
27856
|
+
attributes: fieldProperties == null ? void 0 : fieldProperties.attributes,
|
|
27802
27857
|
isInternal: (fieldProperties == null ? void 0 : fieldProperties.isInternal) || !(fieldProperties == null ? void 0 : fieldProperties.apiType),
|
|
27803
|
-
multiple:
|
|
27804
|
-
value:
|
|
27805
|
-
getSelectedData: (
|
|
27806
|
-
disabled:
|
|
27858
|
+
multiple: isMultiple,
|
|
27859
|
+
value: selectValue,
|
|
27860
|
+
getSelectedData: (selectedRow) => getSelectedData == null ? void 0 : getSelectedData(fieldProperties == null ? void 0 : fieldProperties.field_name, selectedRow),
|
|
27861
|
+
disabled: isFieldDisabled
|
|
27807
27862
|
}
|
|
27808
27863
|
),
|
|
27809
|
-
|
|
27810
|
-
] })
|
|
27811
|
-
|
|
27864
|
+
fieldError && /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { color: "theme.error.600", type: "s5", children: fieldError })
|
|
27865
|
+
] });
|
|
27866
|
+
}
|
|
27867
|
+
if (editVariant === "date") {
|
|
27868
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27812
27869
|
DatePicker2,
|
|
27813
27870
|
{
|
|
27814
27871
|
name: (fieldProperties == null ? void 0 : fieldProperties.field_name) || "",
|
|
27815
|
-
defaultValue,
|
|
27816
|
-
onChange: (v) =>
|
|
27817
|
-
textFieldProps: {
|
|
27818
|
-
|
|
27819
|
-
|
|
27820
|
-
error: (errors == null ? void 0 : errors[column.id]) ? true : false,
|
|
27821
|
-
helperText: errors == null ? void 0 : errors[column.id],
|
|
27872
|
+
defaultValue: columnDefaultValue,
|
|
27873
|
+
onChange: (v) => handleChange(v, "date"),
|
|
27874
|
+
textFieldProps: { autoFocus: shouldAutoFocus },
|
|
27875
|
+
error: Boolean(fieldError),
|
|
27876
|
+
helperText: fieldError,
|
|
27822
27877
|
format: fieldProperties == null ? void 0 : fieldProperties.dateFormat,
|
|
27823
27878
|
placeholder: (fieldProperties == null ? void 0 : fieldProperties.placeholder) || (fieldProperties == null ? void 0 : fieldProperties.dateFormat),
|
|
27824
|
-
value:
|
|
27825
|
-
disabled:
|
|
27826
|
-
minDate: () =>
|
|
27827
|
-
maxDate: () =>
|
|
27879
|
+
value: dateValue,
|
|
27880
|
+
disabled: isFieldDisabled,
|
|
27881
|
+
minDate: () => resolveDateBoundary(fieldProperties == null ? void 0 : fieldProperties.min_date),
|
|
27882
|
+
maxDate: () => resolveDateBoundary(fieldProperties == null ? void 0 : fieldProperties.max_date)
|
|
27828
27883
|
}
|
|
27829
|
-
)
|
|
27830
|
-
|
|
27884
|
+
);
|
|
27885
|
+
}
|
|
27886
|
+
if (editVariant === "date_time") {
|
|
27887
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27831
27888
|
DateTimePicker2,
|
|
27832
27889
|
{
|
|
27833
27890
|
name: (fieldProperties == null ? void 0 : fieldProperties.field_name) || "",
|
|
27834
|
-
defaultValue,
|
|
27835
|
-
onChange: (v) =>
|
|
27836
|
-
textFieldProps: {
|
|
27837
|
-
|
|
27838
|
-
|
|
27839
|
-
error: (errors == null ? void 0 : errors[column.id]) ? true : false,
|
|
27840
|
-
helperText: errors == null ? void 0 : errors[column.id],
|
|
27891
|
+
defaultValue: columnDefaultValue,
|
|
27892
|
+
onChange: (v) => handleChange(v, "date"),
|
|
27893
|
+
textFieldProps: { autoFocus: shouldAutoFocus },
|
|
27894
|
+
error: Boolean(fieldError),
|
|
27895
|
+
helperText: fieldError,
|
|
27841
27896
|
format: fieldProperties == null ? void 0 : fieldProperties.dateFormat,
|
|
27842
27897
|
placeholder: (fieldProperties == null ? void 0 : fieldProperties.placeholder) || (fieldProperties == null ? void 0 : fieldProperties.dateFormat),
|
|
27843
|
-
value:
|
|
27844
|
-
disabled:
|
|
27898
|
+
value: dateValue,
|
|
27899
|
+
disabled: isFieldDisabled
|
|
27845
27900
|
}
|
|
27846
|
-
)
|
|
27847
|
-
|
|
27901
|
+
);
|
|
27902
|
+
}
|
|
27903
|
+
if (editVariant === "file" || editVariant === "image") {
|
|
27904
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Box, { display: "flex", flexDirection: "column", children: [
|
|
27848
27905
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27849
27906
|
UploadMedia,
|
|
27850
27907
|
{
|
|
@@ -27854,48 +27911,51 @@ const InlineEditFields = ({
|
|
|
27854
27911
|
label: "",
|
|
27855
27912
|
type: editVariant,
|
|
27856
27913
|
max_size: 10,
|
|
27857
|
-
onChange: (v) =>
|
|
27858
|
-
error: (
|
|
27859
|
-
multiple: Boolean(
|
|
27860
|
-
value:
|
|
27914
|
+
onChange: (v) => handleChange(v, "file"),
|
|
27915
|
+
error: Boolean(fieldError),
|
|
27916
|
+
multiple: Boolean((fieldProperties == null ? void 0 : fieldProperties.is_multiple) ?? (col == null ? void 0 : col.is_multiple)),
|
|
27917
|
+
value: currentValue
|
|
27861
27918
|
}
|
|
27862
27919
|
),
|
|
27863
|
-
|
|
27864
|
-
] })
|
|
27865
|
-
|
|
27920
|
+
fieldError && /* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { color: "theme.error.600", type: "s5", children: fieldError })
|
|
27921
|
+
] });
|
|
27922
|
+
}
|
|
27923
|
+
if (editVariant === "phone") {
|
|
27924
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27866
27925
|
PhoneInput,
|
|
27867
27926
|
{
|
|
27868
27927
|
name: (fieldProperties == null ? void 0 : fieldProperties.field_name) || "",
|
|
27869
|
-
default_value:
|
|
27870
|
-
onChange: (v) =>
|
|
27871
|
-
textFieldProps: {
|
|
27872
|
-
|
|
27873
|
-
|
|
27874
|
-
error: (errors == null ? void 0 : errors[column.id]) ? true : false,
|
|
27875
|
-
helperText: errors == null ? void 0 : errors[column.id],
|
|
27928
|
+
default_value: columnDefaultValue,
|
|
27929
|
+
onChange: (v) => handleChange(v, "phone"),
|
|
27930
|
+
textFieldProps: { autoFocus: shouldAutoFocus },
|
|
27931
|
+
error: Boolean(fieldError),
|
|
27932
|
+
helperText: fieldError,
|
|
27876
27933
|
format: fieldProperties == null ? void 0 : fieldProperties.dateFormat,
|
|
27877
27934
|
placeholder: (fieldProperties == null ? void 0 : fieldProperties.placeholder) || (fieldProperties == null ? void 0 : fieldProperties.dateFormat),
|
|
27878
|
-
value:
|
|
27879
|
-
disabled:
|
|
27935
|
+
value: currentValue,
|
|
27936
|
+
disabled: isFieldDisabled,
|
|
27880
27937
|
isInlineEditing: true
|
|
27881
27938
|
}
|
|
27882
|
-
)
|
|
27883
|
-
|
|
27939
|
+
);
|
|
27940
|
+
}
|
|
27941
|
+
if (editVariant === "checkbox") {
|
|
27942
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
27884
27943
|
Checkbox,
|
|
27885
27944
|
{
|
|
27886
27945
|
name: (fieldProperties == null ? void 0 : fieldProperties.field_name) || "",
|
|
27887
|
-
defaultChecked: Boolean(
|
|
27888
|
-
onChange: (v) =>
|
|
27889
|
-
error: (
|
|
27890
|
-
helperText:
|
|
27891
|
-
|
|
27892
|
-
|
|
27893
|
-
|
|
27894
|
-
disabled: fieldDisbled
|
|
27946
|
+
defaultChecked: Boolean(columnDefaultValue),
|
|
27947
|
+
onChange: (v) => handleChange(v, "checkbox"),
|
|
27948
|
+
error: Boolean(fieldError),
|
|
27949
|
+
helperText: fieldError,
|
|
27950
|
+
placeholder: fieldProperties == null ? void 0 : fieldProperties.placeholder,
|
|
27951
|
+
value: Boolean(currentValue),
|
|
27952
|
+
disabled: isFieldDisabled
|
|
27895
27953
|
}
|
|
27896
|
-
)
|
|
27897
|
-
|
|
27954
|
+
);
|
|
27955
|
+
}
|
|
27956
|
+
return null;
|
|
27898
27957
|
};
|
|
27958
|
+
const InlineEditFields$1 = React__default.memo(InlineEditFields);
|
|
27899
27959
|
const TableWrapper = styled$2(Box, {
|
|
27900
27960
|
shouldForwardProp: (prop) => prop !== "disableMaxHeight"
|
|
27901
27961
|
})(({ theme: { palette }, disableMaxHeight }) => {
|
|
@@ -28318,7 +28378,7 @@ const MaterialTable = React__default.memo(({
|
|
|
28318
28378
|
...editDisplayMode === "row" ? {
|
|
28319
28379
|
Edit: ({ cell, row: row2, table: table2, column }) => {
|
|
28320
28380
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
28321
|
-
InlineEditFields,
|
|
28381
|
+
InlineEditFields$1,
|
|
28322
28382
|
{
|
|
28323
28383
|
cell,
|
|
28324
28384
|
column,
|
|
@@ -41928,4 +41988,4 @@ export {
|
|
|
41928
41988
|
DynamicTagsInput as y,
|
|
41929
41989
|
DynamicTime as z
|
|
41930
41990
|
};
|
|
41931
|
-
//# sourceMappingURL=android-12-switch-
|
|
41991
|
+
//# sourceMappingURL=android-12-switch-BQHaGZz6.esm.js.map
|