@kengic/core.react 0.0.1-beta.55 → 0.0.1-beta.57

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.
@@ -67452,7 +67452,14 @@ function emit(e) {
67452
67452
  });
67453
67453
  }
67454
67454
  const LOCAL_STORAGE_KEY__WORK_STATION = "KgWorkStation.workStation", LOCAL_STORAGE_KEY__WORK_STATION_AREA = "KgWorkStation.workStationArea", KgWorkStationSlice = createSlice({
67455
- initialState: {},
67455
+ initialState: {
67456
+ "": {
67457
+ isMount: !0,
67458
+ props: { KgWorkStationModal: { isOpen: !1 }, isVisible: !0 },
67459
+ workStation: null,
67460
+ workStationArea: null
67461
+ }
67462
+ },
67456
67463
  name: "KgWorkStation",
67457
67464
  reducers: {
67458
67465
  /**
@@ -67462,9 +67469,7 @@ const LOCAL_STORAGE_KEY__WORK_STATION = "KgWorkStation.workStation", LOCAL_STORA
67462
67469
  * @param action
67463
67470
  */
67464
67471
  closeModal(e, t) {
67465
- const r = t.payload.id;
67466
- if (!r)
67467
- return;
67472
+ const r = t.payload.id ?? "";
67468
67473
  let n = e[r];
67469
67474
  n && (n.props.KgWorkStationModal.isOpen = !1);
67470
67475
  },
@@ -67475,11 +67480,11 @@ const LOCAL_STORAGE_KEY__WORK_STATION = "KgWorkStation.workStation", LOCAL_STORA
67475
67480
  * @param action
67476
67481
  */
67477
67482
  mount(e, t) {
67478
- const r = t.payload.id;
67479
- r && (e[r] = {
67483
+ const r = t.payload.id ?? "";
67484
+ e[r] = {
67480
67485
  isMount: !0,
67481
67486
  props: { KgWorkStationModal: { isOpen: !1 }, isVisible: !0 }
67482
- }, emit({ event: "onMount", id: r }));
67487
+ }, emit({ event: "onMount", id: r });
67483
67488
  },
67484
67489
  /**
67485
67490
  * 打开弹窗.
@@ -67488,9 +67493,7 @@ const LOCAL_STORAGE_KEY__WORK_STATION = "KgWorkStation.workStation", LOCAL_STORA
67488
67493
  * @param action
67489
67494
  */
67490
67495
  openModal(e, t) {
67491
- const r = t.payload.id;
67492
- if (!r)
67493
- return;
67496
+ const r = t.payload.id ?? "";
67494
67497
  let n = e[r];
67495
67498
  n && (n.props.KgWorkStationModal.isOpen = !0);
67496
67499
  },
@@ -67502,9 +67505,7 @@ const LOCAL_STORAGE_KEY__WORK_STATION = "KgWorkStation.workStation", LOCAL_STORA
67502
67505
  */
67503
67506
  set(e, t) {
67504
67507
  var a, s;
67505
- const r = t.payload.id;
67506
- if (!r)
67507
- return;
67508
+ const r = t.payload.id ?? "";
67508
67509
  let n = e[r];
67509
67510
  n && ((s = (a = t.payload).fn) == null || s.call(a, n));
67510
67511
  },
@@ -67515,9 +67516,7 @@ const LOCAL_STORAGE_KEY__WORK_STATION = "KgWorkStation.workStation", LOCAL_STORA
67515
67516
  * @param action
67516
67517
  */
67517
67518
  setWorkStation(e, t) {
67518
- const r = t.payload.id;
67519
- if (!r)
67520
- return;
67519
+ const r = t.payload.id ?? "";
67521
67520
  let n = e[r];
67522
67521
  n && (n.workStation = t.payload.workStation ? { ...t.payload.workStation } : null, storejs.set(LOCAL_STORAGE_KEY__WORK_STATION, n.workStation));
67523
67522
  },
@@ -67528,9 +67527,7 @@ const LOCAL_STORAGE_KEY__WORK_STATION = "KgWorkStation.workStation", LOCAL_STORA
67528
67527
  * @param action
67529
67528
  */
67530
67529
  setWorkStationArea(e, t) {
67531
- const r = t.payload.id;
67532
- if (!r)
67533
- return;
67530
+ const r = t.payload.id ?? "";
67534
67531
  let n = e[r];
67535
67532
  n && (n.workStationArea = t.payload.workStationArea ? { ...t.payload.workStationArea } : null, storejs.set(LOCAL_STORAGE_KEY__WORK_STATION_AREA, n.workStationArea));
67536
67533
  },
@@ -67541,8 +67538,8 @@ const LOCAL_STORAGE_KEY__WORK_STATION = "KgWorkStation.workStation", LOCAL_STORA
67541
67538
  * @param action
67542
67539
  */
67543
67540
  unmount(e, t) {
67544
- const r = t.payload.id;
67545
- r && delete e[r];
67541
+ const r = t.payload.id ?? "";
67542
+ delete e[r];
67546
67543
  }
67547
67544
  }
67548
67545
  }), { set, mount, openModal, closeModal, setWorkStation, setWorkStationArea, unmount } = KgWorkStationSlice.actions;
@@ -67558,14 +67555,14 @@ function getIsOpen(e) {
67558
67555
  return ((a = (n = (r = t[e]) == null ? void 0 : r.props) == null ? void 0 : n.KgWorkStationModal) == null ? void 0 : a.isOpen) ?? !1;
67559
67556
  };
67560
67557
  }
67561
- function getWorkStation(e) {
67558
+ function getWorkStation(e = "") {
67562
67559
  return (t) => {
67563
67560
  var n;
67564
67561
  let r = ((n = t[e]) == null ? void 0 : n.workStation) ?? null;
67565
67562
  return r || (r = storejs.get(LOCAL_STORAGE_KEY__WORK_STATION, null)), r;
67566
67563
  };
67567
67564
  }
67568
- function getWorkStationArea(e) {
67565
+ function getWorkStationArea(e = "") {
67569
67566
  return (t) => {
67570
67567
  var n;
67571
67568
  let r = ((n = t[e]) == null ? void 0 : n.workStationArea) ?? null;
@@ -67615,9 +67612,12 @@ function doKgWorkStation(e = "") {
67615
67612
  return [t, r];
67616
67613
  },
67617
67614
  getWorkStation() {
67618
- const t = ref(getIsVisible(e)(kgWorkStationStore.getState())), r = kgWorkStationStore.subscribe(() => t.value = getWorkStation(e)(kgWorkStationStore.getState()));
67615
+ const t = ref(getWorkStation(e)(kgWorkStationStore.getState())), r = kgWorkStationStore.subscribe(() => t.value = getWorkStation(e)(kgWorkStationStore.getState()));
67619
67616
  return [t, r];
67620
67617
  },
67618
+ getWorkStationSnapshot() {
67619
+ return getWorkStation(e)(kgWorkStationStore.getState());
67620
+ },
67621
67621
  id: e,
67622
67622
  onMount: si({
67623
67623
  event: "onMount",
@@ -67711,7 +67711,7 @@ class KgUtil {
67711
67711
  }
67712
67712
  function KgWorkStationModal() {
67713
67713
  var ia;
67714
- const e = useID(), t = doKgWorkStation(e), r = useIntl(), n = useKg(), a = useKgWorkStationDispatch(), s = useKgWorkStationSelector(getIsVisible(e)), u = useKgWorkStationSelector(getIsOpen(e)), [g, C] = reactExports.useState([]), [w, D] = reactExports.useState([]), [G, ne] = reactExports.useState([]), oe = useKgWorkStationSelector(getWorkStation(e)), se = useKgWorkStationSelector(getWorkStationArea(e)), ue = ((ia = g.find((ca) => ca.devcod === w[0])) == null ? void 0 : ia.workstationAreas) ?? [], ae = {
67714
+ const e = useID(), t = doKgWorkStation(e), r = useIntl(), n = useKg(), a = useKgWorkStationDispatch(), s = useKgWorkStationSelector(getIsVisible(e)), u = useKgWorkStationSelector(getIsOpen(e)), [g, C] = reactExports.useState([]), [w, D] = reactExports.useState([]), [G, ne] = reactExports.useState([]), oe = useKgWorkStationSelector(getWorkStation()), se = useKgWorkStationSelector(getWorkStationArea()), ue = ((ia = g.find((ca) => ca.devcod === w[0])) == null ? void 0 : ia.workstationAreas) ?? [], ae = {
67715
67715
  hideSelectAll: !0,
67716
67716
  onChange(ca) {
67717
67717
  D(ca.length > 1 ? [ca[0]] : ca);
@@ -67744,7 +67744,7 @@ function KgWorkStationModal() {
67744
67744
  }
67745
67745
  function ta() {
67746
67746
  const ca = () => {
67747
- a(setWorkStation({ id: e, workStation: g.find((sa) => sa.devcod === w[0]) ?? null })), a(setWorkStationArea({ id: e, workStationArea: ue.find((sa) => sa.wrkare === G[0]) ?? null }));
67747
+ a(setWorkStation({ workStation: g.find((sa) => sa.devcod === w[0]) ?? null })), a(setWorkStationArea({ workStationArea: ue.find((sa) => sa.wrkare === G[0]) ?? null }));
67748
67748
  };
67749
67749
  s ? (w[0] !== (oe == null ? void 0 : oe.devcod) || G[0] !== (se == null ? void 0 : se.wrkare)) && (ca(), KgUtil.confirm({
67750
67750
  content: n.t("KgWorkStation.reloadMessage"),
@@ -67817,7 +67817,7 @@ function KgWorkStation() {
67817
67817
  const e = useKgSelector(getOption);
67818
67818
  if (!(((G = e == null ? void 0 : e.KgWorkStation) == null ? void 0 : G.isOn) !== !1))
67819
67819
  return null;
67820
- const r = useID(), n = useKg(), a = doKgWorkStation(r), s = useKgWorkStationSelector(getIsVisible(r)), u = useKgWorkStationSelector(getWorkStation(r)), g = useKgWorkStationSelector(getWorkStationArea(r)), C = (() => {
67820
+ const r = useID(), n = useKg(), a = doKgWorkStation(r), s = useKgWorkStationSelector(getIsVisible(r)), u = useKgWorkStationSelector(getWorkStation()), g = useKgWorkStationSelector(getWorkStationArea()), C = (() => {
67821
67821
  let ne = "text";
67822
67822
  return s || (ne += " kgcrant-kg-invisible"), ne;
67823
67823
  })(), w = (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kengic/core.react",
3
- "version": "0.0.1-beta.55",
3
+ "version": "0.0.1-beta.57",
4
4
  "type": "module",
5
5
  "main": "./kengic-core.react.js",
6
6
  "module": "./kengic-core.react.js",
@@ -28,6 +28,10 @@ export interface IDoKgWorkStation {
28
28
  getWorkStation(): [{
29
29
  value: WorkstationDTO | null;
30
30
  }, () => void];
31
+ /**
32
+ * <p>跟 {@link getWorkStation} 一样, 但获取的是快照.</p>
33
+ */
34
+ getWorkStationSnapshot(): WorkstationDTO | null;
31
35
  id: string;
32
36
  /**
33
37
  * 监听事件: 挂载.
@@ -25,18 +25,18 @@ export declare const set: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
25
25
  }, "KgWorkStation/openModal">, closeModal: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
26
26
  id: string | null | undefined;
27
27
  }, "KgWorkStation/closeModal">, setWorkStation: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
28
- id: string | null | undefined;
28
+ id?: string | null | undefined;
29
29
  workStation: WorkstationDTO | null;
30
30
  }, "KgWorkStation/setWorkStation">, setWorkStationArea: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
31
- id: string | null | undefined;
31
+ id?: string | null | undefined;
32
32
  workStationArea: WorkstationAreaDTO | null;
33
33
  }, "KgWorkStation/setWorkStationArea">, unmount: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
34
34
  id: string | null | undefined;
35
35
  }, "KgWorkStation/unmount">;
36
36
  export declare function getIsVisible(id: string): (state: IKgWorkStationState) => boolean;
37
37
  export declare function getIsOpen(id: string): (state: IKgWorkStationState) => boolean;
38
- export declare function getWorkStation(id: string): (state: IKgWorkStationState) => WorkstationDTO | null;
39
- export declare function getWorkStationArea(id: string): (state: IKgWorkStationState) => WorkstationAreaDTO | null;
38
+ export declare function getWorkStation(id?: string): (state: IKgWorkStationState) => WorkstationDTO | null;
39
+ export declare function getWorkStationArea(id?: string): (state: IKgWorkStationState) => WorkstationAreaDTO | null;
40
40
  export declare const kgWorkStationStore: import("@reduxjs/toolkit").EnhancedStore<IKgWorkStationState, import("@reduxjs/toolkit").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("@reduxjs/toolkit").StoreEnhancer<{
41
41
  dispatch: import("@reduxjs/toolkit").ThunkDispatch<IKgWorkStationState, undefined, import("@reduxjs/toolkit").UnknownAction>;
42
42
  }>, import("@reduxjs/toolkit").StoreEnhancer]>>;