@cniot/android-pda-components 2.0.0-beta.4 → 2.0.0-beta.5

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/es/index.es.js CHANGED
@@ -1942,6 +1942,7 @@ class ImageUploader extends Component {
1942
1942
  __publicField(this, "handlerUploadNavigator", () => {
1943
1943
  const { beforeUpload, onBeforeUpload } = this.props;
1944
1944
  const dom = document.querySelector("#inputFile");
1945
+ dom.value = null;
1945
1946
  dom.click();
1946
1947
  dom.onchange = (e2) => {
1947
1948
  let fileData = e2.target.files[0];
@@ -3301,7 +3302,7 @@ class Filed extends JSONWatch {
3301
3302
  this.validateStatusMap = {};
3302
3303
  this.validatorMap = {};
3303
3304
  }
3304
- getProps(key, { validator } = {}) {
3305
+ getProps(key, { validator, formatValue, handleValueInChange } = {}) {
3305
3306
  const realValidator = typeof validator !== "function" && validator !== "required" ? null : (val) => {
3306
3307
  if (validator === "required") {
3307
3308
  validator = (val2) => {
@@ -3311,14 +3312,18 @@ class Filed extends JSONWatch {
3311
3312
  this.validateStatusMap[key] = validator == null ? void 0 : validator(val);
3312
3313
  };
3313
3314
  this.validatorMap[key] = realValidator;
3315
+ const value = this.get(key);
3314
3316
  return {
3315
- value: this.get(key),
3316
- onChange: (value) => {
3317
- if (value && value.target && value.preventDefault) {
3318
- value = value.target.value;
3317
+ value: typeof formatValue === "function" ? formatValue(value, key) : value,
3318
+ onChange: (value2) => {
3319
+ if (value2 && value2.target && value2.preventDefault) {
3320
+ value2 = value2.target.value;
3319
3321
  }
3320
- realValidator == null ? void 0 : realValidator(value);
3321
- this.set(key, value);
3322
+ if (typeof handleValueInChange === "function") {
3323
+ value2 = handleValueInChange(value2, key);
3324
+ }
3325
+ realValidator == null ? void 0 : realValidator(value2);
3326
+ this.set(key, value2);
3322
3327
  }
3323
3328
  };
3324
3329
  }
@@ -15061,6 +15066,33 @@ const ROUND_MAP = /* @__PURE__ */ new Map([
15061
15066
  ["error", error],
15062
15067
  ["warning", warning]
15063
15068
  ]);
15069
+ const ToastForPages = ({ duration, ...restProps }) => {
15070
+ const [visible, setVisible] = React__default.useState(true);
15071
+ React__default.useEffect(() => {
15072
+ const timeId = setTimeout(() => {
15073
+ setVisible(false);
15074
+ }, duration || 5e3);
15075
+ return () => clearTimeout(timeId);
15076
+ }, []);
15077
+ return visible && /* @__PURE__ */ React__default.createElement(Toast, {
15078
+ data: restProps
15079
+ });
15080
+ };
15081
+ ToastForPages.toast = (props) => {
15082
+ const { title = "", message = "" } = props;
15083
+ const _props = { ...props, title, message };
15084
+ let toastRoot = document.getElementById("op-pda-active-toast-for-pages-root");
15085
+ if (!toastRoot) {
15086
+ toastRoot = document.createElement("div");
15087
+ toastRoot.id = "op-pda-active-toast-for-pages-root";
15088
+ document.body.appendChild(toastRoot);
15089
+ }
15090
+ ReactDOM__default.render(/* @__PURE__ */ React__default.createElement(ToastForPages, {
15091
+ key: Math.random(),
15092
+ ..._props,
15093
+ hasNext: false
15094
+ }), toastRoot);
15095
+ };
15064
15096
  var index$3 = "";
15065
15097
  function Alert(props) {
15066
15098
  const { data, onNext } = props;
@@ -15204,6 +15236,7 @@ function Debug() {
15204
15236
  }
15205
15237
  const PageFlowSystemPagesV2 = {
15206
15238
  Toast,
15239
+ ToastForPages,
15207
15240
  Alert,
15208
15241
  Confirm,
15209
15242
  Prompt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cniot/android-pda-components",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.5",
4
4
  "description": "",
5
5
  "main": "./es/index.cjs.js",
6
6
  "module": "./es/index.es.js",