@owp/core 2.5.17 → 2.5.19
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/_virtual/index10.js +2 -2
- package/dist/_virtual/index12.js +2 -2
- package/dist/_virtual/index13.js +2 -2
- package/dist/_virtual/index14.js +2 -2
- package/dist/_virtual/index16.js +4 -4
- package/dist/_virtual/index17.js +4 -4
- package/dist/_virtual/index18.js +4 -4
- package/dist/_virtual/index19.js +4 -4
- package/dist/components/OwpPageContent/OwpPageContent.js +14 -12
- package/dist/components/OwpPageContent/OwpPageContent.js.map +1 -1
- package/dist/components/OwpPageTitle/OwpPageTitle.js +37 -35
- package/dist/components/OwpPageTitle/OwpPageTitle.js.map +1 -1
- package/dist/components/OwpPicker/OwpDatePicker.js +339 -102
- package/dist/components/OwpPicker/OwpDatePicker.js.map +1 -1
- package/dist/components/OwpPicker/OwpDateRangePicker.js +87 -82
- package/dist/components/OwpPicker/OwpDateRangePicker.js.map +1 -1
- package/dist/components/OwpPicker/OwpTimePicker.js +494 -220
- package/dist/components/OwpPicker/OwpTimePicker.js.map +1 -1
- package/dist/components/OwpPicker/constants/index.js +6 -5
- package/dist/components/OwpPicker/constants/index.js.map +1 -1
- package/dist/components/OwpPicker/internal/DatePickerInput.js +71 -47
- package/dist/components/OwpPicker/internal/DatePickerInput.js.map +1 -1
- package/dist/components/OwpSection/OwpSection.js +84 -62
- package/dist/components/OwpSection/OwpSection.js.map +1 -1
- package/dist/components/OwpSelectorBase/OwpSelectorAutocomplete.js +42 -40
- package/dist/components/OwpSelectorBase/OwpSelectorAutocomplete.js.map +1 -1
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js +273 -224
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
- package/dist/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.js +476 -105
- package/dist/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.js.map +1 -1
- package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js +317 -245
- package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js.map +1 -1
- package/dist/components/OwpTreeGrid/internal/treeGridTheme.js +315 -151
- package/dist/components/OwpTreeGrid/internal/treeGridTheme.js.map +1 -1
- package/dist/constants/gridTheme.js +9 -7
- package/dist/constants/gridTheme.js.map +1 -1
- package/dist/constants/treeGrid.js +37 -35
- package/dist/constants/treeGrid.js.map +1 -1
- package/dist/constants.js +25 -23
- package/dist/features/themePreview/configs/grid.js +3 -1
- package/dist/features/themePreview/configs/grid.js.map +1 -1
- package/dist/features/themePreview/utils/themePreviewDefinitions.js +10 -0
- package/dist/features/themePreview/utils/themePreviewDefinitions.js.map +1 -1
- package/dist/layout/components/toggles/NavigationSearchToggle.js +3 -3
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/constants.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/constants.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/constants.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/MSI/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/codabar/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/renderers/index.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/core/utils.js +1 -1
- package/dist/node_modules/.pnpm/qrcode@1.5.4/node_modules/qrcode/lib/renderer/utils.js +1 -1
- package/dist/node_modules/.pnpm/react-overlays@5.2.1_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/react-overlays/esm/Portal.js +1 -1
- package/dist/owp-app.css +1 -1
- package/dist/types/components/OwpPageContent/OwpPageContent.d.ts +3 -1
- package/dist/types/components/OwpPageTitle/OwpPageTitle.d.ts +3 -1
- package/dist/types/components/OwpPicker/OwpTimePicker.d.ts +3 -1
- package/dist/types/components/OwpPicker/constants/index.d.ts +1 -0
- package/dist/types/components/OwpPicker/internal/DatePickerInput.d.ts +7 -0
- package/dist/types/components/OwpSection/OwpSection.d.ts +3 -1
- package/dist/types/components/OwpTreeGrid/OwpTreeGrid.d.ts +6 -6
- package/dist/types/components/OwpTreeGrid/internal/hooks/useOwpTreeGridDatePickerEditor.d.ts +3 -0
- package/dist/types/components/OwpTreeGrid/internal/treeGridRuntime.d.ts +33 -7
- package/dist/types/components/OwpTreeGrid/internal/treeGridTheme.d.ts +1 -1
- package/dist/types/constants/gridTheme.d.ts +4 -0
- package/dist/types/constants/treeGrid.d.ts +3 -1
- package/dist/types/features/themePreview/configs/grid.d.ts +2 -0
- package/dist/types/features/themePreview/configs/settings.d.ts +2 -0
- package/dist/types/types/OwpGridThemeTypes.d.ts +2 -0
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types/utils/treeGridUtil.d.ts +42 -3
- package/dist/utils/treeGridUtil.js +220 -119
- package/dist/utils/treeGridUtil.js.map +1 -1
- package/dist/utils.js +90 -86
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js +0 -84
- package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js.map +0 -1
- package/dist/types/components/OwpTreeGrid/internal/treeGridColumnEditRules.d.ts +0 -60
- package/dist/types/utils/normalizeTimeToHourMinute.d.ts +0 -11
- package/dist/utils/normalizeTimeToHourMinute.js +0 -34
- package/dist/utils/normalizeTimeToHourMinute.js.map +0 -1
package/dist/utils.js
CHANGED
|
@@ -1,102 +1,106 @@
|
|
|
1
1
|
import { generateBarcodeUrl as o } from "./utils/barcodeUtil.js";
|
|
2
2
|
import { buildTreeGridEnumAttributesByCommonCodeList as d, transformCommonCodeBasedOnGroupId as i, transformGridEnumByCommonCodeList as a } from "./utils/commonCodeUtils.js";
|
|
3
|
-
import { createDateRangeSearchParams as
|
|
4
|
-
import { createFormDataBody as
|
|
5
|
-
import { createJsonBody as
|
|
6
|
-
import { createJsonString as
|
|
7
|
-
import { exportExcelByBuffer as
|
|
8
|
-
import { fetchFile as
|
|
9
|
-
import { formatDateToYmd as
|
|
10
|
-
import { formatNumber as
|
|
11
|
-
import { getDisplayValue as
|
|
12
|
-
import { getEstimatedTextCellWidth as
|
|
13
|
-
import { getFormDefaultValues as
|
|
14
|
-
import { getStartPagePath as
|
|
3
|
+
import { createDateRangeSearchParams as m } from "./utils/createDateRangeSearchParams.js";
|
|
4
|
+
import { createFormDataBody as T, normalizeFormDataUploadParams as s } from "./utils/createFormDataBody.js";
|
|
5
|
+
import { createJsonBody as G } from "./utils/createJsonBody.js";
|
|
6
|
+
import { createJsonString as I } from "./utils/createJsonString.js";
|
|
7
|
+
import { exportExcelByBuffer as g, getIndexByLetters as _, getLettersByIndex as L, setCellValue as R, setMergeCells as C } from "./utils/excelUtil.js";
|
|
8
|
+
import { fetchFile as D } from "./utils/fetchFile.js";
|
|
9
|
+
import { formatDateToYmd as y, getTodayYmd as A } from "./utils/formatDateToYmd.js";
|
|
10
|
+
import { formatNumber as h } from "./utils/formatNumber.js";
|
|
11
|
+
import { getDisplayValue as c } from "./utils/getDisplayValue.js";
|
|
12
|
+
import { getEstimatedTextCellWidth as U } from "./utils/getEstimatedTextCellWidth.js";
|
|
13
|
+
import { getFormDefaultValues as w } from "./utils/getFormDefaultValues.js";
|
|
14
|
+
import { getStartPagePath as N } from "./utils/getStartPagePath.js";
|
|
15
15
|
import { getTrimmedValue as P } from "./utils/getTrimmedValue.js";
|
|
16
|
-
import { isEnterKeyEvent as
|
|
17
|
-
import { getApiLanguageCode as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { TREEGRID_CELL_HIGHLIGHT_CLASS as ze, TREEGRID_CELL_HIGHLIGHT_COLOR as Je, TREEGRID_INPUT_CELL_COLOR as Ze, TREEGRID_WARNING_CELL_COLOR as ke } from "./constants/treeGrid.js";
|
|
16
|
+
import { isEnterKeyEvent as W } from "./utils/isEnterKeyEvent.js";
|
|
17
|
+
import { getApiLanguageCode as z, getI18nextLanguageCode as M } from "./utils/language.js";
|
|
18
|
+
import { preloadOnIdle as J } from "./utils/preloadOnIdle.js";
|
|
19
|
+
import { generateQrCodeUrl as Z } from "./utils/qrCodeUtil.js";
|
|
20
|
+
import { rebuildValue as Q } from "./utils/rebuildValue.js";
|
|
21
|
+
import { sanitizePasswordValue as q, sanitizeUserIdValue as X } from "./utils/sanitizeAuthInputValue.js";
|
|
22
|
+
import { exportTreeGridExcel as ee } from "./utils/treeGridExportExcelUtil.js";
|
|
23
|
+
import { isTreeGridCheckedValue as oe, toTreeGridBoolValue as te, toTreeGridYnValue as de } from "./utils/treeGridYnUtils.js";
|
|
24
|
+
import { TREEGRID_ADDED_ROW_BASELINE_VALUES_KEY as ae, TREEGRID_ADDED_ROW_BY_ID_FLAG as le, TREEGRID_ADDED_ROW_HIGHLIGHT_COLUMNS_KEY as me, addTreeGridRowById as Ee, appendTreeGridAddedRowHighlightColumn as Te, clearTreeGridCellHighlightById as se, exportTreeGridToExcelById as ne, getTreeGridAddedRowBaselineValue as Ge, getTreeGridAddedRowHighlightColumns as pe, getTreeGridById as Ie, getTreeGridCellComparableValue as xe, getTreeGridDataRowsById as ge, getTreeGridRowChangesById as _e, getTreeGridSelectedRowsById as Le, highlightTreeGridCellById as Re, isTreeGridRowAddedById as Ce, markTreeGridRowAddedById as fe, normalizeTreeGridExternalRow as De, normalizeTreeGridExternalRows as Be, reloadTreeGridBodyById as ye, removeTreeGridAddedRowHighlightColumn as Ae, resetTreeGridChangesById as ue, resetTreeGridChangesByIds as he, resetTreeGridSelectionById as Oe, resetTreeGridSelectionsByIds as ce, setTreeGridColumnEnumOptionsById as Fe, setTreeGridColumnVisibilityById as Ue } from "./utils/treeGridUtil.js";
|
|
25
|
+
import { readZipEntryJson as we, readZipEntryText as He, saveAsZipFile as Ne } from "./utils/zipUtil.js";
|
|
26
|
+
import { OwpUtils as Pe } from "./utils/common/OwpUtils.js";
|
|
27
|
+
import { DEFAULT_CELL_ALIGNMENT as We, DEFAULT_HEADER_FILL as Ye, DEFAULT_HEADER_FONT as ze, DEFAULT_THIN_BORDER as Me, DEFAULT_VALUE_FONT as ve, DEFAULT_WRAP_CELL_ALIGNMENT as Je } from "./constants/excel.js";
|
|
28
|
+
import { TREEGRID_CELL_CHANGED_CLASS as Ze, TREEGRID_CELL_HIGHLIGHT_COLOR as ke, TREEGRID_INPUT_CELL_COLOR as Qe, TREEGRID_WARNING_CELL_COLOR as je } from "./constants/treeGrid.js";
|
|
30
29
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
We as DEFAULT_CELL_ALIGNMENT,
|
|
31
|
+
Ye as DEFAULT_HEADER_FILL,
|
|
32
|
+
ze as DEFAULT_HEADER_FONT,
|
|
34
33
|
Me as DEFAULT_THIN_BORDER,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
ve as DEFAULT_VALUE_FONT,
|
|
35
|
+
Je as DEFAULT_WRAP_CELL_ALIGNMENT,
|
|
36
|
+
Pe as OwpUtils,
|
|
37
|
+
ae as TREEGRID_ADDED_ROW_BASELINE_VALUES_KEY,
|
|
38
38
|
le as TREEGRID_ADDED_ROW_BY_ID_FLAG,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
me as TREEGRID_ADDED_ROW_HIGHLIGHT_COLUMNS_KEY,
|
|
40
|
+
Ze as TREEGRID_CELL_CHANGED_CLASS,
|
|
41
|
+
ke as TREEGRID_CELL_HIGHLIGHT_COLOR,
|
|
42
|
+
Qe as TREEGRID_INPUT_CELL_COLOR,
|
|
43
|
+
je as TREEGRID_WARNING_CELL_COLOR,
|
|
44
44
|
Ee as addTreeGridRowById,
|
|
45
|
-
|
|
45
|
+
Te as appendTreeGridAddedRowHighlightColumn,
|
|
46
46
|
d as buildTreeGridEnumAttributesByCommonCodeList,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
G as
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
se as clearTreeGridCellHighlightById,
|
|
48
|
+
m as createDateRangeSearchParams,
|
|
49
|
+
T as createFormDataBody,
|
|
50
|
+
G as createJsonBody,
|
|
51
|
+
I as createJsonString,
|
|
52
|
+
g as exportExcelByBuffer,
|
|
53
|
+
ee as exportTreeGridExcel,
|
|
54
|
+
ne as exportTreeGridToExcelById,
|
|
55
|
+
D as fetchFile,
|
|
56
|
+
y as formatDateToYmd,
|
|
57
|
+
h as formatNumber,
|
|
58
58
|
o as generateBarcodeUrl,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
Z as generateQrCodeUrl,
|
|
60
|
+
z as getApiLanguageCode,
|
|
61
|
+
c as getDisplayValue,
|
|
62
|
+
U as getEstimatedTextCellWidth,
|
|
63
|
+
w as getFormDefaultValues,
|
|
64
|
+
M as getI18nextLanguageCode,
|
|
65
|
+
_ as getIndexByLetters,
|
|
66
|
+
L as getLettersByIndex,
|
|
67
|
+
N as getStartPagePath,
|
|
68
|
+
A as getTodayYmd,
|
|
69
|
+
Ge as getTreeGridAddedRowBaselineValue,
|
|
70
|
+
pe as getTreeGridAddedRowHighlightColumns,
|
|
71
|
+
Ie as getTreeGridById,
|
|
72
|
+
xe as getTreeGridCellComparableValue,
|
|
73
|
+
ge as getTreeGridDataRowsById,
|
|
74
|
+
_e as getTreeGridRowChangesById,
|
|
73
75
|
Le as getTreeGridSelectedRowsById,
|
|
74
76
|
P as getTrimmedValue,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
Re as highlightTreeGridCellById,
|
|
78
|
+
W as isEnterKeyEvent,
|
|
79
|
+
oe as isTreeGridCheckedValue,
|
|
80
|
+
Ce as isTreeGridRowAddedById,
|
|
81
|
+
fe as markTreeGridRowAddedById,
|
|
82
|
+
s as normalizeFormDataUploadParams,
|
|
83
|
+
De as normalizeTreeGridExternalRow,
|
|
84
|
+
Be as normalizeTreeGridExternalRows,
|
|
85
|
+
J as preloadOnIdle,
|
|
86
|
+
we as readZipEntryJson,
|
|
87
|
+
He as readZipEntryText,
|
|
88
|
+
Q as rebuildValue,
|
|
89
|
+
ye as reloadTreeGridBodyById,
|
|
90
|
+
Ae as removeTreeGridAddedRowHighlightColumn,
|
|
87
91
|
ue as resetTreeGridChangesById,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
he as resetTreeGridChangesByIds,
|
|
93
|
+
Oe as resetTreeGridSelectionById,
|
|
94
|
+
ce as resetTreeGridSelectionsByIds,
|
|
95
|
+
q as sanitizePasswordValue,
|
|
96
|
+
X as sanitizeUserIdValue,
|
|
97
|
+
Ne as saveAsZipFile,
|
|
98
|
+
R as setCellValue,
|
|
95
99
|
C as setMergeCells,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
Fe as setTreeGridColumnEnumOptionsById,
|
|
101
|
+
Ue as setTreeGridColumnVisibilityById,
|
|
102
|
+
te as toTreeGridBoolValue,
|
|
103
|
+
de as toTreeGridYnValue,
|
|
100
104
|
i as transformCommonCodeBasedOnGroupId,
|
|
101
105
|
a as transformGridEnumByCommonCodeList
|
|
102
106
|
};
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var E = Object.defineProperty;
|
|
2
|
-
var o = (t, i) => E(t, "name", { value: i, configurable: !0 });
|
|
3
|
-
import { normalizeTimeToHourMinute as M, formatTimeInputToHourMinute as f } from "../../../utils/normalizeTimeToHourMinute.js";
|
|
4
|
-
const C = "^$|^[\\d:]*$", R = /* @__PURE__ */ o(function(t, i) {
|
|
5
|
-
var r, d;
|
|
6
|
-
const e = f(t, i);
|
|
7
|
-
!this.Tag || e === t || (this.Tag.value = e, (d = (r = this.Tag).setSelectionRange) == null || d.call(r, e.length, e.length));
|
|
8
|
-
}, "handleHourMinuteEditChange"), h = {
|
|
9
|
-
OnChange: R,
|
|
10
|
-
OnKeyDown: /* @__PURE__ */ o(() => {
|
|
11
|
-
}, "OnKeyDown"),
|
|
12
|
-
OnStartEdit: /* @__PURE__ */ o(() => {
|
|
13
|
-
}, "OnStartEdit")
|
|
14
|
-
}, g = /* @__PURE__ */ o((t) => M(`${t ?? ""}`), "normalizeHourMinuteColumnValue"), v = /* @__PURE__ */ o((t, i) => t === "hourMinute" ? {
|
|
15
|
-
edit: h,
|
|
16
|
-
editMask: C,
|
|
17
|
-
resultMask: "",
|
|
18
|
-
resultText: "",
|
|
19
|
-
normalize: g,
|
|
20
|
-
invalidText: i.hourMinuteInvalidText
|
|
21
|
-
} : {}, "getTreeGridColumnEditPresetDefinition"), m = /* @__PURE__ */ o(() => ({
|
|
22
|
-
appliedColumns: {},
|
|
23
|
-
originalAttributes: {}
|
|
24
|
-
}), "createTreeGridColumnEditRulesState"), A = /* @__PURE__ */ o((t) => {
|
|
25
|
-
t.appliedColumns = {}, t.originalAttributes = {};
|
|
26
|
-
}, "resetTreeGridColumnEditRulesState"), O = /* @__PURE__ */ o((t, i) => {
|
|
27
|
-
if (!(t != null && t.length))
|
|
28
|
-
return;
|
|
29
|
-
const e = {};
|
|
30
|
-
return t.forEach((r) => {
|
|
31
|
-
const d = v(r.preset, i);
|
|
32
|
-
r.columns.forEach((l) => {
|
|
33
|
-
l && (e[l] = d);
|
|
34
|
-
});
|
|
35
|
-
}), Object.keys(e).length > 0 ? e : void 0;
|
|
36
|
-
}, "resolveTreeGridColumnEditRuleLookup"), p = /* @__PURE__ */ o((t, i, e) => {
|
|
37
|
-
if (!t)
|
|
38
|
-
return;
|
|
39
|
-
const r = i ? Object.keys(i) : [], l = Object.keys(e.appliedColumns).filter((n) => !(i != null && i[n]));
|
|
40
|
-
l.length === 0 && r.length === 0 || (t.StartUpdate(), l.forEach((n) => {
|
|
41
|
-
var a;
|
|
42
|
-
const s = (a = t.Cols) == null ? void 0 : a[n], u = e.originalAttributes[n];
|
|
43
|
-
if (!s || !u) {
|
|
44
|
-
delete e.appliedColumns[n];
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
s.Edit = u.Edit, s.EditMask = u.EditMask, s.ResultMask = u.ResultMask, s.ResultText = u.ResultText, delete e.appliedColumns[n];
|
|
48
|
-
}), r.forEach((n) => {
|
|
49
|
-
var c, T;
|
|
50
|
-
const s = (c = t.Cols) == null ? void 0 : c[n], u = i == null ? void 0 : i[n];
|
|
51
|
-
if (!s || !u)
|
|
52
|
-
return;
|
|
53
|
-
(T = e.originalAttributes)[n] ?? (T[n] = {
|
|
54
|
-
Edit: s.Edit,
|
|
55
|
-
EditMask: s.EditMask,
|
|
56
|
-
ResultMask: s.ResultMask,
|
|
57
|
-
ResultText: s.ResultText
|
|
58
|
-
});
|
|
59
|
-
const a = e.originalAttributes[n];
|
|
60
|
-
s.Edit = u.edit ?? a.Edit, s.EditMask = u.editMask ?? a.EditMask, s.ResultMask = u.resultMask ?? a.ResultMask, s.ResultText = u.resultText ?? a.ResultText, e.appliedColumns[n] = !0;
|
|
61
|
-
}), t.EndUpdate());
|
|
62
|
-
}, "syncTreeGridColumnEditRules"), k = /* @__PURE__ */ o((t, i, e) => {
|
|
63
|
-
const r = t == null ? void 0 : t[i], d = r == null ? void 0 : r.normalize;
|
|
64
|
-
if (typeof d != "function")
|
|
65
|
-
return;
|
|
66
|
-
const l = d(e), n = `${e ?? ""}`;
|
|
67
|
-
if (l == null)
|
|
68
|
-
return n ? {
|
|
69
|
-
value: "",
|
|
70
|
-
invalidText: r == null ? void 0 : r.invalidText
|
|
71
|
-
} : void 0;
|
|
72
|
-
if (l !== n)
|
|
73
|
-
return {
|
|
74
|
-
value: l
|
|
75
|
-
};
|
|
76
|
-
}, "resolveTreeGridColumnEditValue");
|
|
77
|
-
export {
|
|
78
|
-
m as createTreeGridColumnEditRulesState,
|
|
79
|
-
A as resetTreeGridColumnEditRulesState,
|
|
80
|
-
O as resolveTreeGridColumnEditRuleLookup,
|
|
81
|
-
k as resolveTreeGridColumnEditValue,
|
|
82
|
-
p as syncTreeGridColumnEditRules
|
|
83
|
-
};
|
|
84
|
-
//# sourceMappingURL=treeGridColumnEditRules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"treeGridColumnEditRules.js","sources":["../../../../src/components/OwpTreeGrid/internal/treeGridColumnEditRules.ts"],"sourcesContent":["import {\n formatTimeInputToHourMinute,\n normalizeTimeToHourMinute,\n} from '@/utils/normalizeTimeToHourMinute';\nimport type {\n OwpTreeGridColumnEditPreset,\n OwpTreeGridColumnEditRule,\n} from '../OwpTreeGrid';\n\nconst HOUR_MINUTE_EDIT_MASK = '^$|^[\\\\d:]*$';\n\ntype TreeGridColumnEditValue = TCol['Edit'] | TEdit;\ntype TreeGridColumnEditAttributeSnapshot = {\n Edit?: TreeGridColumnEditValue;\n EditMask?: TCol['EditMask'];\n ResultMask?: TCol['ResultMask'];\n ResultText?: TCol['ResultText'];\n};\ntype TreeGridColumnEditMutableColumn = Omit<TCol, 'Edit'> & TreeGridColumnEditAttributeSnapshot;\n\ntype TreeGridColumnEditPresetMessages = {\n hourMinuteInvalidText: string;\n};\n\ntype TreeGridColumnEditPresetDefinition = {\n edit?: TreeGridColumnEditValue;\n editMask?: string;\n resultMask?: string;\n resultText?: string;\n normalize?: (value: unknown) => string | null | undefined;\n invalidText?: string;\n};\n\ntype TreeGridColumnEditRuleLookup = Record<string, TreeGridColumnEditPresetDefinition>;\n\ntype TreeGridColumnEditRulesState = {\n appliedColumns: Record<string, true>;\n originalAttributes: Record<string, TreeGridColumnEditAttributeSnapshot>;\n};\n\ntype HourMinuteEdit = {\n Tag?: HTMLInputElement | HTMLTextAreaElement | null;\n};\n\n/**\n * HH:mm 편집 중 입력 보정\n * @param value 현재 입력값\n * @param oldValue 이전 입력값\n */\nconst handleHourMinuteEditChange = function (this: HourMinuteEdit, value: string, oldValue: string) {\n const formattedValue = formatTimeInputToHourMinute(value, oldValue);\n\n if (!this.Tag || formattedValue === value) {\n return;\n }\n\n this.Tag.value = formattedValue;\n this.Tag.setSelectionRange?.(formattedValue.length, formattedValue.length);\n};\n\nconst HOUR_MINUTE_EDIT: TEdit = {\n OnChange: handleHourMinuteEditChange,\n OnKeyDown: () => {},\n OnStartEdit: () => {},\n};\n\nconst normalizeHourMinuteColumnValue = (value: unknown) => {\n return normalizeTimeToHourMinute(`${value ?? ''}`);\n};\n\nconst getTreeGridColumnEditPresetDefinition = (\n preset: OwpTreeGridColumnEditPreset,\n messages: TreeGridColumnEditPresetMessages,\n): TreeGridColumnEditPresetDefinition => {\n if (preset === 'hourMinute') {\n return {\n edit: HOUR_MINUTE_EDIT,\n editMask: HOUR_MINUTE_EDIT_MASK,\n resultMask: '',\n resultText: '',\n normalize: normalizeHourMinuteColumnValue,\n invalidText: messages.hourMinuteInvalidText,\n };\n }\n\n return {};\n};\n\n/**\n * 컬럼 편집 규칙 상태 생성\n */\nexport const createTreeGridColumnEditRulesState = (): TreeGridColumnEditRulesState => {\n return {\n appliedColumns: {},\n originalAttributes: {},\n };\n};\n\n/**\n * 컬럼 편집 규칙 상태 초기화\n * @param state 컬럼 편집 규칙 상태\n */\nexport const resetTreeGridColumnEditRulesState = (state: TreeGridColumnEditRulesState) => {\n state.appliedColumns = {};\n state.originalAttributes = {};\n};\n\n/**\n * 컬럼 편집 규칙 lookup 생성\n * @param rules 컬럼 편집 규칙 목록\n * @param messages preset 메시지 집합\n */\nexport const resolveTreeGridColumnEditRuleLookup = (\n rules: readonly OwpTreeGridColumnEditRule[] | undefined,\n messages: TreeGridColumnEditPresetMessages,\n) => {\n if (!rules?.length) {\n return undefined;\n }\n\n const lookup: TreeGridColumnEditRuleLookup = {};\n\n rules.forEach((rule) => {\n const presetDefinition = getTreeGridColumnEditPresetDefinition(rule.preset, messages);\n\n rule.columns.forEach((column) => {\n if (column) {\n lookup[column] = presetDefinition;\n }\n });\n });\n\n return Object.keys(lookup).length > 0 ? lookup : undefined;\n};\n\n/**\n * 컬럼 편집 규칙 동기화\n * @param grid TreeGrid 인스턴스\n * @param lookup 컬럼 편집 규칙 lookup\n * @param state 컬럼 편집 규칙 상태\n */\nexport const syncTreeGridColumnEditRules = (\n grid: TGrid | null,\n lookup: TreeGridColumnEditRuleLookup | undefined,\n state: TreeGridColumnEditRulesState,\n) => {\n if (!grid) {\n return;\n }\n\n const nextColumns = lookup ? Object.keys(lookup) : [];\n const previousColumns = Object.keys(state.appliedColumns);\n const columnsToRestore = previousColumns.filter((column) => !lookup?.[column]);\n\n if (columnsToRestore.length === 0 && nextColumns.length === 0) {\n return;\n }\n\n grid.StartUpdate();\n\n columnsToRestore.forEach((columnName) => {\n const column = grid.Cols?.[columnName] as TreeGridColumnEditMutableColumn | undefined;\n const originalAttributes = state.originalAttributes[columnName];\n\n if (!column || !originalAttributes) {\n delete state.appliedColumns[columnName];\n return;\n }\n\n column.Edit = originalAttributes.Edit;\n column.EditMask = originalAttributes.EditMask;\n column.ResultMask = originalAttributes.ResultMask;\n column.ResultText = originalAttributes.ResultText;\n\n delete state.appliedColumns[columnName];\n });\n\n nextColumns.forEach((columnName) => {\n const column = grid.Cols?.[columnName] as TreeGridColumnEditMutableColumn | undefined;\n const presetDefinition = lookup?.[columnName];\n\n if (!column || !presetDefinition) {\n return;\n }\n\n state.originalAttributes[columnName] ??= {\n Edit: column.Edit,\n EditMask: column.EditMask,\n ResultMask: column.ResultMask,\n ResultText: column.ResultText,\n };\n\n const originalAttributes = state.originalAttributes[columnName];\n\n column.Edit = presetDefinition.edit ?? originalAttributes.Edit;\n column.EditMask = presetDefinition.editMask ?? originalAttributes.EditMask;\n column.ResultMask = presetDefinition.resultMask ?? originalAttributes.ResultMask;\n column.ResultText = presetDefinition.resultText ?? originalAttributes.ResultText;\n\n state.appliedColumns[columnName] = true;\n });\n\n grid.EndUpdate();\n};\n\n/**\n * 컬럼 편집 규칙 최종값 정규화\n * @param lookup 컬럼 편집 규칙 lookup\n * @param columnName 컬럼명\n * @param value 원본 값\n */\nexport const resolveTreeGridColumnEditValue = (\n lookup: TreeGridColumnEditRuleLookup | undefined,\n columnName: string,\n value: unknown,\n) => {\n const presetDefinition = lookup?.[columnName];\n const normalize = presetDefinition?.normalize;\n\n if (typeof normalize !== 'function') {\n return undefined;\n }\n\n const normalizedValue = normalize(value);\n const currentValue = `${value ?? ''}`;\n\n if (normalizedValue == null) {\n return currentValue\n ? {\n value: '',\n invalidText: presetDefinition?.invalidText,\n }\n : undefined;\n }\n\n if (normalizedValue === currentValue) {\n return undefined;\n }\n\n return {\n value: normalizedValue,\n };\n};\n\nexport type { TreeGridColumnEditRuleLookup, TreeGridColumnEditRulesState };\n"],"names":["HOUR_MINUTE_EDIT_MASK","handleHourMinuteEditChange","__name","value","oldValue","formattedValue","formatTimeInputToHourMinute","_b","_a","HOUR_MINUTE_EDIT","normalizeHourMinuteColumnValue","normalizeTimeToHourMinute","getTreeGridColumnEditPresetDefinition","preset","messages","createTreeGridColumnEditRulesState","resetTreeGridColumnEditRulesState","state","resolveTreeGridColumnEditRuleLookup","rules","lookup","rule","presetDefinition","column","syncTreeGridColumnEditRules","grid","nextColumns","columnsToRestore","columnName","originalAttributes","resolveTreeGridColumnEditValue","normalize","normalizedValue","currentValue"],"mappings":";;;AASA,MAAMA,IAAwB,gBAwCxBC,IAA6B,gBAAAC,EAAA,SAAgCC,GAAeC,GAAkB;;AAClG,QAAMC,IAAiBC,EAA4BH,GAAOC,CAAQ;AAElE,EAAI,CAAC,KAAK,OAAOC,MAAmBF,MAIpC,KAAK,IAAI,QAAQE,IACjBE,KAAAC,IAAA,KAAK,KAAI,sBAAT,QAAAD,EAAA,KAAAC,GAA6BH,EAAe,QAAQA,EAAe;AACrE,GATmC,+BAW7BI,IAA0B;AAAA,EAC9B,UAAUR;AAAA,EACV,WAAW,gBAAAC,EAAA,MAAM;AAAA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OS,KAAc;AACvB;AAGF,QAAMC,IAAkBD,EAAU5B,CAAK,GACjC8B,IAAe,GAAG9B,KAAS,EAAE;AAEnC,MAAI6B,KAAmB;AACrB,WAAOC,IACH;AAAA,MACE,OAAO;AAAA,MACP,aAAaX,KAAA,gBAAAA,EAAkB;AAAA,IAAA,IAEjC;AAGN,MAAIU,MAAoBC;AAIxB,WAAO;AAAA,MACL,OAAOD;AAAA,IAAA;AAEX,GA/B8C;"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { OwpTreeGridColumnEditRule } from '../OwpTreeGrid';
|
|
2
|
-
type TreeGridColumnEditValue = TCol['Edit'] | TEdit;
|
|
3
|
-
type TreeGridColumnEditAttributeSnapshot = {
|
|
4
|
-
Edit?: TreeGridColumnEditValue;
|
|
5
|
-
EditMask?: TCol['EditMask'];
|
|
6
|
-
ResultMask?: TCol['ResultMask'];
|
|
7
|
-
ResultText?: TCol['ResultText'];
|
|
8
|
-
};
|
|
9
|
-
type TreeGridColumnEditPresetMessages = {
|
|
10
|
-
hourMinuteInvalidText: string;
|
|
11
|
-
};
|
|
12
|
-
type TreeGridColumnEditPresetDefinition = {
|
|
13
|
-
edit?: TreeGridColumnEditValue;
|
|
14
|
-
editMask?: string;
|
|
15
|
-
resultMask?: string;
|
|
16
|
-
resultText?: string;
|
|
17
|
-
normalize?: (value: unknown) => string | null | undefined;
|
|
18
|
-
invalidText?: string;
|
|
19
|
-
};
|
|
20
|
-
type TreeGridColumnEditRuleLookup = Record<string, TreeGridColumnEditPresetDefinition>;
|
|
21
|
-
type TreeGridColumnEditRulesState = {
|
|
22
|
-
appliedColumns: Record<string, true>;
|
|
23
|
-
originalAttributes: Record<string, TreeGridColumnEditAttributeSnapshot>;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* 컬럼 편집 규칙 상태 생성
|
|
27
|
-
*/
|
|
28
|
-
export declare const createTreeGridColumnEditRulesState: () => TreeGridColumnEditRulesState;
|
|
29
|
-
/**
|
|
30
|
-
* 컬럼 편집 규칙 상태 초기화
|
|
31
|
-
* @param state 컬럼 편집 규칙 상태
|
|
32
|
-
*/
|
|
33
|
-
export declare const resetTreeGridColumnEditRulesState: (state: TreeGridColumnEditRulesState) => void;
|
|
34
|
-
/**
|
|
35
|
-
* 컬럼 편집 규칙 lookup 생성
|
|
36
|
-
* @param rules 컬럼 편집 규칙 목록
|
|
37
|
-
* @param messages preset 메시지 집합
|
|
38
|
-
*/
|
|
39
|
-
export declare const resolveTreeGridColumnEditRuleLookup: (rules: readonly OwpTreeGridColumnEditRule[] | undefined, messages: TreeGridColumnEditPresetMessages) => TreeGridColumnEditRuleLookup;
|
|
40
|
-
/**
|
|
41
|
-
* 컬럼 편집 규칙 동기화
|
|
42
|
-
* @param grid TreeGrid 인스턴스
|
|
43
|
-
* @param lookup 컬럼 편집 규칙 lookup
|
|
44
|
-
* @param state 컬럼 편집 규칙 상태
|
|
45
|
-
*/
|
|
46
|
-
export declare const syncTreeGridColumnEditRules: (grid: TGrid | null, lookup: TreeGridColumnEditRuleLookup | undefined, state: TreeGridColumnEditRulesState) => void;
|
|
47
|
-
/**
|
|
48
|
-
* 컬럼 편집 규칙 최종값 정규화
|
|
49
|
-
* @param lookup 컬럼 편집 규칙 lookup
|
|
50
|
-
* @param columnName 컬럼명
|
|
51
|
-
* @param value 원본 값
|
|
52
|
-
*/
|
|
53
|
-
export declare const resolveTreeGridColumnEditValue: (lookup: TreeGridColumnEditRuleLookup | undefined, columnName: string, value: unknown) => {
|
|
54
|
-
value: string;
|
|
55
|
-
invalidText: string;
|
|
56
|
-
} | {
|
|
57
|
-
value: string;
|
|
58
|
-
invalidText?: undefined;
|
|
59
|
-
};
|
|
60
|
-
export type { TreeGridColumnEditRuleLookup, TreeGridColumnEditRulesState };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 시간 입력 문자열을 편집 중 HH:mm 형태로 포맷
|
|
3
|
-
* @param value 현재 입력값
|
|
4
|
-
* @param oldValue 이전 입력값
|
|
5
|
-
*/
|
|
6
|
-
export declare const formatTimeInputToHourMinute: (value: string, oldValue?: string) => string;
|
|
7
|
-
/**
|
|
8
|
-
* 시간 문자열을 HH:mm 형식으로 정규화
|
|
9
|
-
* @param value 원본 시간 문자열
|
|
10
|
-
*/
|
|
11
|
-
export declare const normalizeTimeToHourMinute: (value?: string | null) => string;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var o = Object.defineProperty;
|
|
2
|
-
var r = (e, n) => o(e, "name", { value: n, configurable: !0 });
|
|
3
|
-
import { isString as l } from "../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/predicate/isString.js";
|
|
4
|
-
const m = /* @__PURE__ */ r((e) => {
|
|
5
|
-
const n = e.replace(/[^\d:]/g, "");
|
|
6
|
-
if (!n.includes(":"))
|
|
7
|
-
return n.slice(0, 4);
|
|
8
|
-
const [i = "", t = ""] = n.split(":");
|
|
9
|
-
return `${i.slice(0, 2)}:${t.replace(/:/g, "").slice(0, 3)}`;
|
|
10
|
-
}, "sanitizeTimeInputValue"), a = /* @__PURE__ */ r((e) => e.replace(/\D/g, "").slice(0, 4), "getTimeDigits"), f = /* @__PURE__ */ r((e, n = "") => {
|
|
11
|
-
const i = m(e);
|
|
12
|
-
if (!i)
|
|
13
|
-
return "";
|
|
14
|
-
if (e.length < n.length)
|
|
15
|
-
return i;
|
|
16
|
-
const t = a(e);
|
|
17
|
-
return t.length === 1 ? `${t}:` : t.length === 2 ? `${t}:` : t.length === 3 ? `${t.slice(0, 1)}:${t.slice(1)}` : `${t.slice(0, 2)}:${t.slice(2, 4)}`;
|
|
18
|
-
}, "formatTimeInputToHourMinute"), h = /* @__PURE__ */ r((e) => {
|
|
19
|
-
if (!l(e))
|
|
20
|
-
return null;
|
|
21
|
-
const n = f(e.trim());
|
|
22
|
-
if (!n)
|
|
23
|
-
return "";
|
|
24
|
-
const i = n.match(/^(\d{1,2}):(\d{2})$/);
|
|
25
|
-
if (!i)
|
|
26
|
-
return null;
|
|
27
|
-
const [, t = "", s = ""] = i, u = Number(t), c = Number(s);
|
|
28
|
-
return u < 0 || u > 23 || c < 0 || c > 59 ? null : `${u.toString().padStart(2, "0")}:${s}`;
|
|
29
|
-
}, "normalizeTimeToHourMinute");
|
|
30
|
-
export {
|
|
31
|
-
f as formatTimeInputToHourMinute,
|
|
32
|
-
h as normalizeTimeToHourMinute
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=normalizeTimeToHourMinute.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeTimeToHourMinute.js","sources":["../../src/utils/normalizeTimeToHourMinute.ts"],"sourcesContent":["import { isString } from 'es-toolkit/compat';\n\nconst sanitizeTimeInputValue = (value: string) => {\n const sanitizedValue = value.replace(/[^\\d:]/g, '');\n\n if (!sanitizedValue.includes(':')) {\n return sanitizedValue.slice(0, 4);\n }\n\n const [hourText = '', minuteText = ''] = sanitizedValue.split(':');\n\n return `${hourText.slice(0, 2)}:${minuteText.replace(/:/g, '').slice(0, 3)}`;\n};\n\nconst getTimeDigits = (value: string) => value.replace(/\\D/g, '').slice(0, 4);\n\n/**\n * 시간 입력 문자열을 편집 중 HH:mm 형태로 포맷\n * @param value 현재 입력값\n * @param oldValue 이전 입력값\n */\nexport const formatTimeInputToHourMinute = (value: string, oldValue = '') => {\n const sanitizedValue = sanitizeTimeInputValue(value);\n\n if (!sanitizedValue) {\n return '';\n }\n\n if (value.length < oldValue.length) {\n return sanitizedValue;\n }\n\n const digits = getTimeDigits(value);\n\n if (digits.length === 1) {\n return `${digits}:`;\n }\n\n if (digits.length === 2) {\n return `${digits}:`;\n }\n\n if (digits.length === 3) {\n return `${digits.slice(0, 1)}:${digits.slice(1)}`;\n }\n\n return `${digits.slice(0, 2)}:${digits.slice(2, 4)}`;\n};\n\n/**\n * 시간 문자열을 HH:mm 형식으로 정규화\n * @param value 원본 시간 문자열\n */\nexport const normalizeTimeToHourMinute = (value?: string | null) => {\n if (!isString(value)) {\n return null;\n }\n\n const formattedValue = formatTimeInputToHourMinute(value.trim());\n\n if (!formattedValue) {\n return '';\n }\n\n const timeMatch = formattedValue.match(/^(\\d{1,2}):(\\d{2})$/);\n\n if (!timeMatch) {\n return null;\n }\n\n const [, hourText = '', minuteText = ''] = timeMatch;\n const hour = Number(hourText);\n const minute = Number(minuteText);\n\n if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {\n return null;\n }\n\n return `${hour.toString().padStart(2, '0')}:${minuteText}`;\n};\n"],"names":["sanitizeTimeInputValue","__name","value","sanitizedValue","hourText","minuteText","getTimeDigits","formatTimeInputToHourMinute","oldValue","digits","normalizeTimeToHourMinute","isString","formattedValue","timeMatch","hour","minute"],"mappings":";;;AAEA,MAAMA,IAAyB,gBAAAC,EAAA,CAACC,MAAkB;AAChD,QAAMC,IAAiBD,EAAM,QAAQ,WAAW,EAAE;AAElD,MAAI,CAACC,EAAe,SAAS,GAAG;AAC9B,WAAOA,EAAe,MAAM,GAAG,CAAC;AAGlC,QAAM,CAACC,IAAW,IAAIC,IAAa,EAAE,IAAIF,EAAe,MAAM,GAAG;AAEjE,SAAO,GAAGC,EAAS,MAAM,GAAG,CAAC,CAAC,IAAIC,EAAW,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;AAC5E,GAV+B,2BAYzBC,IAAgB,gBAAAL,EAAA,CAACC,MAAkBA,EAAM,QAAQ,OAAO,EAAE,EAAE,MAAM,GAAG,CAAC,GAAtD,kBAOTK,IAA8B,gBAAAN,EAAA,CAACC,GAAeM,IAAW,OAAO;AAC3E,QAAML,IAAiBH,EAAuBE,CAAK;AAEnD,MAAI,CAACC;AACH,WAAO;AAGT,MAAID,EAAM,SAASM,EAAS;AAC1B,WAAOL;AAGT,QAAMM,IAASH,EAAcJ,CAAK;AAElC,SAAIO,EAAO,WAAW,IACb,GAAGA,CAAM,MAGdA,EAAO,WAAW,IACb,GAAGA,CAAM,MA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