@teamco/ischeduler-antd 2.0.14 → 2.0.16
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/antd/src/components/Scheduler.d.ts +4 -6
- package/dist/antd/src/components/Scheduler.d.ts.map +1 -1
- package/dist/antd/src/components/SchedulerDrawerButton.d.ts +4 -8
- package/dist/antd/src/components/SchedulerDrawerButton.d.ts.map +1 -1
- package/dist/antd/src/components/SchedulersList.d.ts +2 -2
- package/dist/antd/src/components/SchedulersList.d.ts.map +1 -1
- package/dist/antd/src/components/behaviors/AfterBehavior.d.ts +2 -2
- package/dist/antd/src/components/behaviors/AfterBehavior.d.ts.map +1 -1
- package/dist/antd/src/components/behaviors/MonthlyBehavior.d.ts +3 -3
- package/dist/antd/src/components/behaviors/MonthlyBehavior.d.ts.map +1 -1
- package/dist/antd/src/components/behaviors/OnThisDayBehavior.d.ts +2 -2
- package/dist/antd/src/components/behaviors/OnThisDayBehavior.d.ts.map +1 -1
- package/dist/antd/src/components/behaviors/WeeklyBehavior.d.ts +3 -3
- package/dist/antd/src/components/behaviors/WeeklyBehavior.d.ts.map +1 -1
- package/dist/antd/src/components/behaviors/YearlyBehavior.d.ts +3 -3
- package/dist/antd/src/components/behaviors/YearlyBehavior.d.ts.map +1 -1
- package/dist/antd/src/components/internal/CheckboxButton.d.ts +3 -3
- package/dist/antd/src/components/internal/CheckboxButton.d.ts.map +1 -1
- package/dist/antd/src/components/internal/DeleteAction.d.ts +3 -3
- package/dist/antd/src/components/internal/DeleteAction.d.ts.map +1 -1
- package/dist/antd/src/components/internal/DrawerEditAction.d.ts +3 -3
- package/dist/antd/src/components/internal/DrawerEditAction.d.ts.map +1 -1
- package/dist/antd/src/components/internal/Duration.d.ts +2 -2
- package/dist/antd/src/components/internal/Duration.d.ts.map +1 -1
- package/dist/antd/src/components/internal/HideColumns.d.ts +2 -2
- package/dist/antd/src/components/internal/HideColumns.d.ts.map +1 -1
- package/dist/antd/src/components/internal/SaveButton.d.ts +5 -5
- package/dist/antd/src/components/internal/SaveButton.d.ts.map +1 -1
- package/dist/antd/src/components/internal/StatusTag.d.ts +2 -2
- package/dist/antd/src/components/internal/StatusTag.d.ts.map +1 -1
- package/dist/antd/src/components/internal/Toolbar.d.ts +4 -4
- package/dist/antd/src/components/internal/Toolbar.d.ts.map +1 -1
- package/dist/antd/src/components/metadata/SchedulerMenu.d.ts +19 -0
- package/dist/antd/src/components/metadata/SchedulerMenu.d.ts.map +1 -0
- package/dist/antd/src/components/metadata/metadata.handlers.d.ts +4 -3
- package/dist/antd/src/components/metadata/metadata.handlers.d.ts.map +1 -1
- package/dist/antd/src/components/metadata/schedulersList.metadata.d.ts +4 -4
- package/dist/antd/src/components/metadata/schedulersList.metadata.d.ts.map +1 -1
- package/dist/antd/src/index.d.ts.map +1 -1
- package/dist/antd/src/stories/mocks/scheduler.mocks.d.ts +12 -0
- package/dist/antd/src/stories/mocks/scheduler.mocks.d.ts.map +1 -0
- package/dist/antd/src/utils/index.d.ts +2 -0
- package/dist/antd/src/utils/index.d.ts.map +1 -0
- package/dist/antd/src/utils/table.util.d.ts +1 -1
- package/dist/antd/src/utils/table.util.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +204 -207
- package/package.json +4 -4
- package/dist/antd/src/types/less.d.ts +0 -9
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CDiscountTypeValues as e, CEndReasonTypes as t, CFirstDayIdx as n, CNsDiscount as r, CNsDuration as i, COLORS as a, CScheduler as o, DEFAULT_DATE_TIME_FORMAT as s, DEFAULT_DISCOUNT_SCHEDULER as c, DEFAULT_SALE_SCHEDULER as l, DEFAULT_SCHEDULERS_LIMIT as u, EDays as d, EDiscountType as f, EDurationTypes as p, EMonths as m, ESchedulerPrefix as h, EStatus as g, EWeekDays as _, getDisabledDate as v, getKeyFromEnum as y, handleChangeStartDate as b, handleDurationValueChange as x, handleSelectWeeklyDay as S, isReadOnlyField as C, mergeNames as w, numberToCurrency as T, placeholderField as E, requiredField as D, setNestedDynamicFields as
|
|
2
|
-
import { Button as
|
|
1
|
+
import { CDiscountTypeValues as e, CEndReasonTypes as t, CFirstDayIdx as n, CNsDiscount as r, CNsDuration as i, COLORS as a, CScheduler as o, DEFAULT_DATE_TIME_FORMAT as s, DEFAULT_DISCOUNT_SCHEDULER as c, DEFAULT_SALE_SCHEDULER as l, DEFAULT_SCHEDULERS_LIMIT as u, EDays as d, EDiscountType as f, EDurationTypes as p, EMonths as m, ESchedulerPrefix as h, EStatus as g, EWeekDays as _, getDisabledDate as v, getKeyFromEnum as y, handleChangeStartDate as b, handleDurationValueChange as x, handleSelectWeeklyDay as S, isReadOnlyField as C, mergeNames as w, numberToCurrency as T, placeholderField as E, requiredField as D, setNestedDynamicFields as O, tsToLocaleDateTime as k, useColumnsToggle as A, useSchedulerContext as j } from "@teamco/ischeduler-core";
|
|
2
|
+
import { Button as M, Checkbox as N, Col as P, DatePicker as F, Drawer as I, Dropdown as L, Form as R, InputNumber as z, Popconfirm as ee, Row as B, Segmented as te, Select as V, Space as H, Table as ne, Tag as U, Tooltip as W } from "antd";
|
|
3
3
|
import { useCallback as G, useEffect as K, useMemo as q, useRef as re, useState as J } from "react";
|
|
4
4
|
import { Fragment as Y, jsx as X, jsxs as Z } from "react/jsx-runtime";
|
|
5
5
|
import { CalendarTwoTone as Q, CheckCircleOutlined as ie, ControlTwoTone as ae, DeleteTwoTone as oe, EditTwoTone as se, FieldNumberOutlined as ce, MinusCircleOutlined as le, MoreOutlined as ue, PlusOutlined as de, ReloadOutlined as fe, SaveOutlined as pe, ScheduleTwoTone as me, SyncOutlined as he } from "@ant-design/icons";
|
|
6
6
|
import ge from "dayjs";
|
|
7
7
|
export * from "@teamco/ischeduler-core";
|
|
8
8
|
//#region \0rolldown/runtime.js
|
|
9
|
-
var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, be = Object.getOwnPropertyNames, xe = Object.getPrototypeOf, Se = Object.prototype.hasOwnProperty, Ce = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), we = (e, t, n, r) => {
|
|
9
|
+
var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, be = Object.getOwnPropertyNames, xe = Object.getPrototypeOf, Se = Object.prototype.hasOwnProperty, Ce = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), we = (e, t, n, r) => {
|
|
10
10
|
if (t && typeof t == "object" || typeof t == "function") for (var i = be(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Se.call(e, s) && s !== n && ve(e, s, {
|
|
11
11
|
get: ((e) => t[e]).bind(null, s),
|
|
12
12
|
enumerable: !(r = ye(t, s)) || r.enumerable
|
|
@@ -16,12 +16,12 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
16
16
|
value: e,
|
|
17
17
|
enumerable: !0
|
|
18
18
|
}) : n, e)), Ee = (e) => {
|
|
19
|
-
let { t } =
|
|
20
|
-
return /* @__PURE__ */ X(
|
|
19
|
+
let { t } = j(), { min: n = 1, label: r, disabled: a, durationTypes: o = [], required: s, prefix: c = [], exclude: l = [], namespace: u = i, onTypeChange: d, onValueChange: f } = e;
|
|
20
|
+
return /* @__PURE__ */ X(R.Item, {
|
|
21
21
|
label: r,
|
|
22
22
|
children: /* @__PURE__ */ Z(H.Compact, {
|
|
23
23
|
style: { width: "100%" },
|
|
24
|
-
children: [/* @__PURE__ */ X(
|
|
24
|
+
children: [/* @__PURE__ */ X(R.Item, {
|
|
25
25
|
noStyle: !0,
|
|
26
26
|
name: w(c, u, "type"),
|
|
27
27
|
rules: [D(t("scheduler.meta.duration"), s)],
|
|
@@ -35,12 +35,12 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
35
35
|
label: p[e]
|
|
36
36
|
}))
|
|
37
37
|
})
|
|
38
|
-
}), /* @__PURE__ */ X(
|
|
38
|
+
}), /* @__PURE__ */ X(R.Item, {
|
|
39
39
|
noStyle: !0,
|
|
40
40
|
name: w(c, u, "period"),
|
|
41
41
|
tooltip: D(r).message,
|
|
42
42
|
rules: [D(r, s)],
|
|
43
|
-
children: /* @__PURE__ */ X(
|
|
43
|
+
children: /* @__PURE__ */ X(z, {
|
|
44
44
|
min: n,
|
|
45
45
|
onChange: f,
|
|
46
46
|
style: { width: "100%" },
|
|
@@ -51,12 +51,12 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
53
|
}, De = (e) => {
|
|
54
|
-
let { t } =
|
|
55
|
-
return /* @__PURE__ */ X(
|
|
54
|
+
let { t } = j(), { min: n = 1, prefix: r = [], disabled: i = !1, required: a = !0 } = e, o = t("scheduler.occurrences");
|
|
55
|
+
return /* @__PURE__ */ X(R.Item, {
|
|
56
56
|
label: o,
|
|
57
57
|
name: w(r, "range", "endReason", "occurrences"),
|
|
58
58
|
rules: [D(o, a)],
|
|
59
|
-
children: /* @__PURE__ */ X(
|
|
59
|
+
children: /* @__PURE__ */ X(z, {
|
|
60
60
|
min: n,
|
|
61
61
|
style: { width: "calc(100% - 90px)" },
|
|
62
62
|
disabled: i,
|
|
@@ -89,40 +89,40 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
89
89
|
return n;
|
|
90
90
|
}) : window.classNames = n;
|
|
91
91
|
})();
|
|
92
|
-
})))(), 1), ke =
|
|
93
|
-
checkboxWrapper:
|
|
92
|
+
})))(), 1), ke = {
|
|
93
|
+
checkboxWrapper: "_checkboxWrapper_1kjv1_1",
|
|
94
94
|
"ant-checkbox-wrapper-checked": "_ant-checkbox-wrapper-checked_1kjv1_21",
|
|
95
|
-
antCheckboxWrapperChecked:
|
|
96
|
-
primary:
|
|
97
|
-
hide:
|
|
98
|
-
},
|
|
95
|
+
antCheckboxWrapperChecked: "_ant-checkbox-wrapper-checked_1kjv1_21",
|
|
96
|
+
primary: "_primary_1kjv1_25",
|
|
97
|
+
hide: "_hide_1kjv1_33"
|
|
98
|
+
}, Ae = (e) => {
|
|
99
99
|
let { loading: t, className: n, disabled: r, onChange: i, options: a = [], value: o = [], type: s = "primary", behavior: c = "hide" } = e;
|
|
100
|
-
return /* @__PURE__ */ X(
|
|
100
|
+
return /* @__PURE__ */ X(N.Group, {
|
|
101
101
|
options: a,
|
|
102
|
-
className: (0, Oe.default)(n,
|
|
102
|
+
className: (0, Oe.default)(n, ke.checkboxWrapper, ke[s], ke[c]),
|
|
103
103
|
value: o,
|
|
104
104
|
disabled: r || t,
|
|
105
105
|
onChange: i
|
|
106
106
|
});
|
|
107
|
-
},
|
|
108
|
-
scheduler:
|
|
109
|
-
result:
|
|
110
|
-
drawerContent:
|
|
111
|
-
chipLabel:
|
|
112
|
-
monthlyGridDay:
|
|
113
|
-
monthlyGridWeek:
|
|
114
|
-
monthsSeparator:
|
|
115
|
-
monthWrapper:
|
|
116
|
-
monthComponents:
|
|
117
|
-
weekWrapper:
|
|
107
|
+
}, $ = {
|
|
108
|
+
scheduler: "_scheduler_aqesn_1",
|
|
109
|
+
result: "_result_aqesn_4",
|
|
110
|
+
drawerContent: "_drawerContent_aqesn_10",
|
|
111
|
+
chipLabel: "_chipLabel_aqesn_13",
|
|
112
|
+
monthlyGridDay: "_monthlyGridDay_aqesn_18",
|
|
113
|
+
monthlyGridWeek: "_monthlyGridWeek_aqesn_25",
|
|
114
|
+
monthsSeparator: "_monthsSeparator_aqesn_37",
|
|
115
|
+
monthWrapper: "_monthWrapper_aqesn_45",
|
|
116
|
+
monthComponents: "_monthComponents_aqesn_50",
|
|
117
|
+
weekWrapper: "_weekWrapper_aqesn_70",
|
|
118
118
|
"ant-checkbox-wrapper-checked": "_ant-checkbox-wrapper-checked_aqesn_73",
|
|
119
|
-
antCheckboxWrapperChecked:
|
|
120
|
-
weekDaysWrap:
|
|
121
|
-
yearWrapper:
|
|
122
|
-
monthsWrapper:
|
|
123
|
-
tagsWrapper:
|
|
124
|
-
},
|
|
125
|
-
let { t, loading: r } =
|
|
119
|
+
antCheckboxWrapperChecked: "_ant-checkbox-wrapper-checked_aqesn_73",
|
|
120
|
+
weekDaysWrap: "_weekDaysWrap_aqesn_88",
|
|
121
|
+
yearWrapper: "_yearWrapper_aqesn_91",
|
|
122
|
+
monthsWrapper: "_monthsWrapper_aqesn_91",
|
|
123
|
+
tagsWrapper: "_tagsWrapper_aqesn_104"
|
|
124
|
+
}, je = (e) => {
|
|
125
|
+
let { t, loading: r } = j(), { formRef: i, shortFormat: a = !0, isMultiple: o = !1, extendBy: s = [], namespaces: c = ["repeat", "weekly"], prefix: l, disabled: u, setOccurs: f } = e, p = w([...l, ...c], "days"), m = re([]);
|
|
126
126
|
K(() => {
|
|
127
127
|
let e = i.getFieldValue(p);
|
|
128
128
|
Array.isArray(e) && e.length && (m.current = e, h());
|
|
@@ -165,11 +165,11 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
165
165
|
]);
|
|
166
166
|
return /* @__PURE__ */ X("div", {
|
|
167
167
|
className: (0, Oe.default)($.weekWrapper, T),
|
|
168
|
-
children: /* @__PURE__ */ X(
|
|
168
|
+
children: /* @__PURE__ */ X(R.Item, {
|
|
169
169
|
label: t("scheduler.days"),
|
|
170
170
|
name: p,
|
|
171
171
|
rules: [D(t("scheduler.days"))],
|
|
172
|
-
children: /* @__PURE__ */ X(
|
|
172
|
+
children: /* @__PURE__ */ X(Ae, {
|
|
173
173
|
loading: r,
|
|
174
174
|
disabled: u,
|
|
175
175
|
options: C,
|
|
@@ -177,8 +177,8 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
177
177
|
})
|
|
178
178
|
})
|
|
179
179
|
});
|
|
180
|
-
},
|
|
181
|
-
let { t, loading: n } =
|
|
180
|
+
}, Me = (e) => {
|
|
181
|
+
let { t, loading: n } = j(), { min: r = 1, max: i = 31, prefix: a, disabled: o = !1, namespaces: s = ["repeat", "monthly"], formRef: c, setOccurs: l } = e, [u, d] = J("DAY"), f = R.useWatch(w([...a, ...s], "weekDay"), c), p = t("scheduler.day"), m = G((e) => {
|
|
182
182
|
if (d(e), e === "DAY") {
|
|
183
183
|
let e = c.getFieldValue(a);
|
|
184
184
|
S(e.duration.period, e, l, t);
|
|
@@ -222,10 +222,10 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
222
222
|
icon: f === r ? /* @__PURE__ */ X(Q, {}) : /* @__PURE__ */ X(Q, { twoToneColor: "gray" })
|
|
223
223
|
};
|
|
224
224
|
});
|
|
225
|
-
return /* @__PURE__ */ Z(
|
|
225
|
+
return /* @__PURE__ */ Z(P, {
|
|
226
226
|
span: 24,
|
|
227
227
|
className: $.monthlyGridWeek,
|
|
228
|
-
children: [/* @__PURE__ */ X(
|
|
228
|
+
children: [/* @__PURE__ */ X(R.Item, {
|
|
229
229
|
noStyle: !0,
|
|
230
230
|
name: w([...a, ...s], "weekDay"),
|
|
231
231
|
rules: [D(t("scheduler.weekday"))],
|
|
@@ -239,7 +239,7 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
239
239
|
disabled: o || n
|
|
240
240
|
}))
|
|
241
241
|
})
|
|
242
|
-
}), /* @__PURE__ */ X(
|
|
242
|
+
}), /* @__PURE__ */ X(je, {
|
|
243
243
|
formRef: c,
|
|
244
244
|
prefix: a,
|
|
245
245
|
isMultiple: !0,
|
|
@@ -274,15 +274,15 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
274
274
|
a,
|
|
275
275
|
l,
|
|
276
276
|
t
|
|
277
|
-
]), g = () => u === "DAY" ? /* @__PURE__ */ X(
|
|
277
|
+
]), g = () => u === "DAY" ? /* @__PURE__ */ X(P, {
|
|
278
278
|
span: 12,
|
|
279
279
|
className: $.monthlyGridDay,
|
|
280
|
-
children: /* @__PURE__ */ X(
|
|
280
|
+
children: /* @__PURE__ */ X(R.Item, {
|
|
281
281
|
noStyle: !0,
|
|
282
282
|
name: w([...a, ...s], "monthDay"),
|
|
283
283
|
hasFeedback: !0,
|
|
284
284
|
rules: [D(t("scheduler.days"))],
|
|
285
|
-
children: /* @__PURE__ */ X(
|
|
285
|
+
children: /* @__PURE__ */ X(z, {
|
|
286
286
|
style: { width: 120 },
|
|
287
287
|
min: r,
|
|
288
288
|
max: i,
|
|
@@ -297,7 +297,7 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
297
297
|
}) : null;
|
|
298
298
|
return /* @__PURE__ */ Z("div", {
|
|
299
299
|
className: $.monthWrapper,
|
|
300
|
-
children: [/* @__PURE__ */ X(
|
|
300
|
+
children: [/* @__PURE__ */ X(R.Item, {
|
|
301
301
|
noStyle: !0,
|
|
302
302
|
name: w([...a, ...s], "type"),
|
|
303
303
|
rules: [D(t("scheduler.meta.period"))],
|
|
@@ -321,8 +321,8 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
321
321
|
children: [g(), h()]
|
|
322
322
|
})]
|
|
323
323
|
});
|
|
324
|
-
},
|
|
325
|
-
let { disabled: t, prefix: n } = e, { t: r } =
|
|
324
|
+
}, Ne = (e) => {
|
|
325
|
+
let { disabled: t, prefix: n } = e, { t: r } = j(), i = R.useWatch(w(n, "range", "startedAt")), a = {
|
|
326
326
|
format: s,
|
|
327
327
|
showTime: !0,
|
|
328
328
|
disabledDate: (e) => {
|
|
@@ -332,14 +332,14 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
332
332
|
},
|
|
333
333
|
disabled: t || !i
|
|
334
334
|
}, o = r("scheduler.duration.endDate");
|
|
335
|
-
return /* @__PURE__ */ X(
|
|
335
|
+
return /* @__PURE__ */ X(R.Item, {
|
|
336
336
|
label: o,
|
|
337
337
|
name: w(n, "range", "endReason", "expiredAt"),
|
|
338
338
|
rules: [D(o, !0)],
|
|
339
|
-
children: /* @__PURE__ */ X(
|
|
339
|
+
children: /* @__PURE__ */ X(F, { ...a })
|
|
340
340
|
});
|
|
341
|
-
},
|
|
342
|
-
let { t, loading: n } =
|
|
341
|
+
}, Pe = (e) => {
|
|
342
|
+
let { t, loading: n } = j(), { shortFormat: r = !0, isMultiple: i = !1, setOccurs: a, formRef: o, prefix: s, namespaces: c = ["repeat", "yearly"], disabled: l } = e, [u, d] = J([]), f = w([...s, ...c], "months"), p = q(() => Object.keys(m).map((e) => t(`scheduler.months.${m[e].toLowerCase()}`)), [t]), h = q(() => Object.keys(m).map((e) => t(`scheduler.months.short.${m[e].toLowerCase()}`)), [t]);
|
|
343
343
|
K(() => {
|
|
344
344
|
let e = o.getFieldValue(f);
|
|
345
345
|
e && _(e);
|
|
@@ -353,7 +353,7 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
353
353
|
value: e
|
|
354
354
|
})), _ = (e) => {
|
|
355
355
|
let n = [...e];
|
|
356
|
-
n.length ? i || (n = e.filter((e) => !u.includes(e))) : n = u, d(n),
|
|
356
|
+
n.length ? i || (n = e.filter((e) => !u.includes(e))) : n = u, d(n), O(o, f.join("."), n);
|
|
357
357
|
let r = o.getFieldValue(s);
|
|
358
358
|
x({
|
|
359
359
|
type: r.duration.type,
|
|
@@ -362,11 +362,11 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
362
362
|
};
|
|
363
363
|
return /* @__PURE__ */ Z("div", {
|
|
364
364
|
className: $.yearWrapper,
|
|
365
|
-
children: [/* @__PURE__ */ X(
|
|
365
|
+
children: [/* @__PURE__ */ X(R.Item, {
|
|
366
366
|
noStyle: !0,
|
|
367
367
|
name: f,
|
|
368
368
|
rules: [D(t("scheduler.months"))],
|
|
369
|
-
children: /* @__PURE__ */ X(
|
|
369
|
+
children: /* @__PURE__ */ X(Ae, {
|
|
370
370
|
options: g,
|
|
371
371
|
disabled: l,
|
|
372
372
|
className: $.monthsWrapper,
|
|
@@ -374,15 +374,15 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
374
374
|
onChange: _,
|
|
375
375
|
value: u
|
|
376
376
|
})
|
|
377
|
-
}), /* @__PURE__ */ X(
|
|
377
|
+
}), /* @__PURE__ */ X(Me, {
|
|
378
378
|
formRef: o,
|
|
379
379
|
prefix: s,
|
|
380
380
|
disabled: l,
|
|
381
381
|
setOccurs: a
|
|
382
382
|
})]
|
|
383
383
|
});
|
|
384
|
-
},
|
|
385
|
-
let { t: n, loading: a } =
|
|
384
|
+
}, Fe = (e) => {
|
|
385
|
+
let { t: n, loading: a } = j(), { formRef: o, prefix: u, entity: d, onFinish: p, disabled: m = !1, durationTypes: g = [], discountTypes: _ = [], readOnlyFields: y = [], schedulerType: S } = e, [T, E] = J(null), [O, k] = J("0"), A = R.useWatch(u, o), M = q(() => S === h.SALE ? l : c, [S]);
|
|
386
386
|
K(() => {
|
|
387
387
|
if (d) {
|
|
388
388
|
let e = {}, t = e;
|
|
@@ -394,13 +394,13 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
394
394
|
o,
|
|
395
395
|
u
|
|
396
396
|
]), K(() => {
|
|
397
|
-
if (!
|
|
398
|
-
let e =
|
|
399
|
-
e && b(e,
|
|
400
|
-
let t =
|
|
401
|
-
t?.type && t?.period && x(t,
|
|
402
|
-
}, [
|
|
403
|
-
let
|
|
397
|
+
if (!A) return;
|
|
398
|
+
let e = A.range?.startedAt;
|
|
399
|
+
e && b(e, E);
|
|
400
|
+
let t = A.duration;
|
|
401
|
+
t?.type && t?.period && x(t, A, k, n);
|
|
402
|
+
}, [A, n]);
|
|
403
|
+
let N = A?.range?.endReason?.type, I = A?.duration?.type, L = q(() => {
|
|
404
404
|
let e = {}, t = e;
|
|
405
405
|
for (let e = 0; e < u.length - 1; e++) t[u[e]] = {}, t = t[u[e]];
|
|
406
406
|
return t[u[u.length - 1]] = M, e;
|
|
@@ -408,43 +408,42 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
408
408
|
return /* @__PURE__ */ X(H, {
|
|
409
409
|
orientation: "vertical",
|
|
410
410
|
style: { width: "100%" },
|
|
411
|
-
children: /* @__PURE__ */ Z(
|
|
411
|
+
children: /* @__PURE__ */ Z(R, {
|
|
412
412
|
layout: "vertical",
|
|
413
413
|
autoComplete: "off",
|
|
414
414
|
form: o,
|
|
415
415
|
className: $.scheduler,
|
|
416
416
|
onFinish: p,
|
|
417
|
-
|
|
418
|
-
initialValues: z,
|
|
417
|
+
initialValues: L,
|
|
419
418
|
children: [
|
|
420
|
-
[h.DISCOUNT, h.TRIAL_DISCOUNT].includes(
|
|
419
|
+
[h.DISCOUNT, h.TRIAL_DISCOUNT].includes(S) && /* @__PURE__ */ X(B, {
|
|
421
420
|
gutter: [24, 24],
|
|
422
|
-
children: /* @__PURE__ */ X(
|
|
421
|
+
children: /* @__PURE__ */ X(P, {
|
|
423
422
|
span: 12,
|
|
424
|
-
children: /* @__PURE__ */ X(
|
|
423
|
+
children: /* @__PURE__ */ X(R.Item, {
|
|
425
424
|
label: n("scheduler.meta.discount"),
|
|
426
|
-
children: /* @__PURE__ */ Z(H.Compact, { children: [/* @__PURE__ */ X(
|
|
425
|
+
children: /* @__PURE__ */ Z(H.Compact, { children: [/* @__PURE__ */ X(R.Item, {
|
|
427
426
|
noStyle: !0,
|
|
428
427
|
name: w(u, r, "type"),
|
|
429
428
|
rules: [D(n("scheduler.meta.discount"), !0)],
|
|
430
429
|
children: /* @__PURE__ */ X(V, {
|
|
431
430
|
style: { width: 150 },
|
|
432
|
-
disabled:
|
|
433
|
-
options:
|
|
431
|
+
disabled: m || a,
|
|
432
|
+
options: _.sort().map((e, t) => ({
|
|
434
433
|
key: t,
|
|
435
434
|
label: f[e],
|
|
436
435
|
value: e
|
|
437
436
|
}))
|
|
438
437
|
})
|
|
439
|
-
}), /* @__PURE__ */ X(
|
|
438
|
+
}), /* @__PURE__ */ X(R.Item, {
|
|
440
439
|
noStyle: !0,
|
|
441
440
|
name: w(u, r, "value"),
|
|
442
441
|
rules: [D(n("scheduler.meta.discount"), !0)],
|
|
443
|
-
children: /* @__PURE__ */ X(
|
|
442
|
+
children: /* @__PURE__ */ X(z, {
|
|
444
443
|
min: 1,
|
|
445
444
|
style: { width: "100%" },
|
|
446
|
-
readOnly: C(w(null, r, "value").join("."),
|
|
447
|
-
disabled:
|
|
445
|
+
readOnly: C(w(null, r, "value").join("."), y),
|
|
446
|
+
disabled: m || a
|
|
448
447
|
})
|
|
449
448
|
})] })
|
|
450
449
|
})
|
|
@@ -452,27 +451,27 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
452
451
|
}),
|
|
453
452
|
/* @__PURE__ */ Z(B, {
|
|
454
453
|
gutter: [24, 24],
|
|
455
|
-
children: [/* @__PURE__ */ X(
|
|
454
|
+
children: [/* @__PURE__ */ X(P, {
|
|
456
455
|
span: 12,
|
|
457
456
|
children: /* @__PURE__ */ X(Ee, {
|
|
458
457
|
label: n("scheduler.duration"),
|
|
459
|
-
disabled:
|
|
458
|
+
disabled: m || a,
|
|
460
459
|
prefix: u,
|
|
461
460
|
namespace: i,
|
|
462
461
|
required: !0,
|
|
463
|
-
durationTypes:
|
|
462
|
+
durationTypes: g
|
|
464
463
|
})
|
|
465
|
-
}), /* @__PURE__ */ X(
|
|
464
|
+
}), /* @__PURE__ */ X(P, {
|
|
466
465
|
span: 12,
|
|
467
|
-
children: /* @__PURE__ */ X(
|
|
466
|
+
children: /* @__PURE__ */ X(R.Item, {
|
|
468
467
|
label: n("scheduler.startedAt"),
|
|
469
468
|
name: w(u, "range", "startedAt"),
|
|
470
469
|
rules: [D(n("scheduler.startedAt"))],
|
|
471
|
-
children: /* @__PURE__ */ X(
|
|
470
|
+
children: /* @__PURE__ */ X(F, {
|
|
472
471
|
showTime: !0,
|
|
473
472
|
format: s,
|
|
474
473
|
disabledDate: (e) => v(e),
|
|
475
|
-
disabled:
|
|
474
|
+
disabled: m || a,
|
|
476
475
|
style: { width: "100%" }
|
|
477
476
|
})
|
|
478
477
|
})
|
|
@@ -480,51 +479,51 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
480
479
|
}),
|
|
481
480
|
I === "WEEK" && /* @__PURE__ */ X(B, {
|
|
482
481
|
gutter: [24, 24],
|
|
483
|
-
children: /* @__PURE__ */ X(
|
|
482
|
+
children: /* @__PURE__ */ X(P, {
|
|
484
483
|
span: 24,
|
|
485
|
-
children: /* @__PURE__ */ X(
|
|
484
|
+
children: /* @__PURE__ */ X(je, {
|
|
486
485
|
prefix: u,
|
|
487
486
|
isMultiple: !0,
|
|
488
487
|
formRef: o,
|
|
489
488
|
setOccurs: k,
|
|
490
|
-
disabled:
|
|
489
|
+
disabled: m
|
|
491
490
|
})
|
|
492
491
|
})
|
|
493
492
|
}),
|
|
494
493
|
I === "MONTH" && /* @__PURE__ */ X(B, {
|
|
495
494
|
gutter: [24, 24],
|
|
496
|
-
children: /* @__PURE__ */ X(
|
|
495
|
+
children: /* @__PURE__ */ X(P, {
|
|
497
496
|
span: 24,
|
|
498
|
-
children: /* @__PURE__ */ X(
|
|
497
|
+
children: /* @__PURE__ */ X(Me, {
|
|
499
498
|
formRef: o,
|
|
500
499
|
prefix: u,
|
|
501
|
-
disabled:
|
|
500
|
+
disabled: m,
|
|
502
501
|
setOccurs: k
|
|
503
502
|
})
|
|
504
503
|
})
|
|
505
504
|
}),
|
|
506
505
|
I === "YEAR" && /* @__PURE__ */ X(B, {
|
|
507
506
|
gutter: [24, 24],
|
|
508
|
-
children: /* @__PURE__ */ X(
|
|
507
|
+
children: /* @__PURE__ */ X(P, {
|
|
509
508
|
span: 24,
|
|
510
|
-
children: /* @__PURE__ */ X(
|
|
509
|
+
children: /* @__PURE__ */ X(Pe, {
|
|
511
510
|
formRef: o,
|
|
512
511
|
prefix: u,
|
|
513
|
-
disabled:
|
|
512
|
+
disabled: m,
|
|
514
513
|
setOccurs: k
|
|
515
514
|
})
|
|
516
515
|
})
|
|
517
516
|
}),
|
|
518
517
|
/* @__PURE__ */ Z(B, {
|
|
519
518
|
gutter: [24, 24],
|
|
520
|
-
children: [/* @__PURE__ */ X(
|
|
519
|
+
children: [/* @__PURE__ */ X(P, {
|
|
521
520
|
span: 12,
|
|
522
|
-
children: /* @__PURE__ */ X(
|
|
521
|
+
children: /* @__PURE__ */ X(R.Item, {
|
|
523
522
|
label: n("scheduler.duration.end"),
|
|
524
523
|
name: w(u, "range", "endReason", "type"),
|
|
525
524
|
rules: [D(n("scheduler.duration.end"))],
|
|
526
525
|
children: /* @__PURE__ */ X(V, {
|
|
527
|
-
disabled:
|
|
526
|
+
disabled: m,
|
|
528
527
|
options: [
|
|
529
528
|
n("scheduler.duration.end.day"),
|
|
530
529
|
n("scheduler.duration.end.after"),
|
|
@@ -536,14 +535,14 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
536
535
|
}))
|
|
537
536
|
})
|
|
538
537
|
})
|
|
539
|
-
}), /* @__PURE__ */ Z(
|
|
538
|
+
}), /* @__PURE__ */ Z(P, {
|
|
540
539
|
span: 12,
|
|
541
|
-
children: [
|
|
540
|
+
children: [N === t[0] && /* @__PURE__ */ X(Ne, {
|
|
542
541
|
prefix: u,
|
|
543
|
-
disabled:
|
|
544
|
-
}),
|
|
542
|
+
disabled: m
|
|
543
|
+
}), N === t[1] && /* @__PURE__ */ X(De, {
|
|
545
544
|
prefix: u,
|
|
546
|
-
disabled:
|
|
545
|
+
disabled: m
|
|
547
546
|
})]
|
|
548
547
|
})]
|
|
549
548
|
}),
|
|
@@ -551,15 +550,15 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
551
550
|
className: $.result,
|
|
552
551
|
dangerouslySetInnerHTML: { __html: n("scheduler.result", {
|
|
553
552
|
occurs: O,
|
|
554
|
-
startAt:
|
|
553
|
+
startAt: T ?? ""
|
|
555
554
|
}) }
|
|
556
555
|
})
|
|
557
556
|
]
|
|
558
557
|
})
|
|
559
558
|
});
|
|
560
|
-
},
|
|
561
|
-
let { t, permissions: n } =
|
|
562
|
-
return (o ? n.canUpdate : n.canCreate) ? /* @__PURE__ */ X(
|
|
559
|
+
}, Ie = (e) => {
|
|
560
|
+
let { t, permissions: n } = j(), { formRef: r, loading: i, className: a, isEdit: o, disabled: s, size: c = "small", color: l = "primary", icon: u = /* @__PURE__ */ X(pe, {}), htmlType: d = "submit", variant: f = "solid", onClick: p, danger: m = !1 } = e;
|
|
561
|
+
return (o ? n.canUpdate : n.canCreate) ? /* @__PURE__ */ X(M, {
|
|
563
562
|
size: c,
|
|
564
563
|
variant: f,
|
|
565
564
|
htmlType: d,
|
|
@@ -574,69 +573,69 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
574
573
|
color: l,
|
|
575
574
|
children: t(o ? "actions.update" : "actions.save")
|
|
576
575
|
}) : null;
|
|
577
|
-
},
|
|
578
|
-
let { t:
|
|
579
|
-
if (!
|
|
580
|
-
let
|
|
576
|
+
}, Le = ({ schedulerType: e, disabled: t, onSuccess: n, isCreating: i, setIsCreating: a, buttonProps: s }) => {
|
|
577
|
+
let { t: c, loading: l, limit: d = u, permissions: m, onCreate: g } = j(), [_] = R.useForm(), [v, y] = J(!1), b = q(() => [o, e], [e]), x = q(() => Object.keys(p), []), S = q(() => Object.keys(f), []);
|
|
578
|
+
if (!m.canCreate) return null;
|
|
579
|
+
let C = async () => {
|
|
581
580
|
try {
|
|
582
|
-
|
|
583
|
-
let t =
|
|
581
|
+
a(!0), await _.validateFields();
|
|
582
|
+
let t = _.getFieldValue(b), i = {
|
|
584
583
|
id: `new-${Date.now()}`,
|
|
585
584
|
...t,
|
|
586
585
|
type: e,
|
|
587
586
|
[r]: e === h.SALE ? null : t?.[r]
|
|
588
587
|
};
|
|
589
|
-
|
|
588
|
+
g && await g(e, i), n?.(i), y(!1), _.resetFields();
|
|
590
589
|
} catch {} finally {
|
|
591
|
-
|
|
590
|
+
a(!1);
|
|
592
591
|
}
|
|
593
592
|
};
|
|
594
|
-
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(
|
|
593
|
+
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(M, {
|
|
595
594
|
style: { padding: 0 },
|
|
596
595
|
color: "default",
|
|
597
596
|
variant: "link",
|
|
598
|
-
...
|
|
599
|
-
loading:
|
|
597
|
+
...s,
|
|
598
|
+
loading: l || i,
|
|
600
599
|
disabled: t,
|
|
601
600
|
onClick: (e) => {
|
|
602
|
-
e.preventDefault(), e.stopPropagation(),
|
|
601
|
+
e.preventDefault(), e.stopPropagation(), _.resetFields(), y(!0);
|
|
603
602
|
},
|
|
604
603
|
children: /* @__PURE__ */ X(W, {
|
|
605
|
-
title: t ?
|
|
606
|
-
children:
|
|
604
|
+
title: t ? c("scheduler.limited", { limit: d }) : void 0,
|
|
605
|
+
children: c("scheduler")
|
|
607
606
|
})
|
|
608
|
-
}), /* @__PURE__ */ X(
|
|
607
|
+
}), /* @__PURE__ */ X(I, {
|
|
609
608
|
title: /* @__PURE__ */ Z("div", {
|
|
610
609
|
style: {
|
|
611
610
|
display: "flex",
|
|
612
611
|
alignItems: "center",
|
|
613
612
|
gap: 8
|
|
614
613
|
},
|
|
615
|
-
children: [/* @__PURE__ */ X(me, {}),
|
|
614
|
+
children: [/* @__PURE__ */ X(me, {}), c("scheduler")]
|
|
616
615
|
}),
|
|
617
616
|
size: 600,
|
|
618
|
-
open:
|
|
617
|
+
open: v,
|
|
618
|
+
destroyOnHidden: !0,
|
|
619
619
|
onClose: () => {
|
|
620
|
-
|
|
620
|
+
y(!1);
|
|
621
621
|
},
|
|
622
|
-
extra: /* @__PURE__ */ X(
|
|
622
|
+
extra: /* @__PURE__ */ X(Ie, {
|
|
623
623
|
size: "small",
|
|
624
|
-
loading:
|
|
625
|
-
disabled: t
|
|
626
|
-
onClick:
|
|
624
|
+
loading: l || i,
|
|
625
|
+
disabled: t,
|
|
626
|
+
onClick: C
|
|
627
627
|
}),
|
|
628
|
-
children: /* @__PURE__ */ X(
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
prefix: S,
|
|
628
|
+
children: v && /* @__PURE__ */ X(Fe, {
|
|
629
|
+
formRef: _,
|
|
630
|
+
prefix: b,
|
|
632
631
|
schedulerType: e,
|
|
633
|
-
durationTypes:
|
|
634
|
-
discountTypes:
|
|
632
|
+
durationTypes: x,
|
|
633
|
+
discountTypes: S,
|
|
635
634
|
disabled: t
|
|
636
635
|
})
|
|
637
636
|
})] });
|
|
638
|
-
},
|
|
639
|
-
let { t } =
|
|
637
|
+
}, Re = (e) => {
|
|
638
|
+
let { t } = j(), { selectedColumns: n = [], columnsList: r = [], onChange: i } = e;
|
|
640
639
|
if (!r?.length) return /* @__PURE__ */ X(Y, {});
|
|
641
640
|
let a = t("table.hideColumns"), o = {
|
|
642
641
|
mode: "multiple",
|
|
@@ -656,8 +655,8 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
656
655
|
value: n,
|
|
657
656
|
onChange: s
|
|
658
657
|
});
|
|
659
|
-
},
|
|
660
|
-
let { loading: t, t: n } =
|
|
658
|
+
}, ze = (e) => {
|
|
659
|
+
let { loading: t, t: n } = j(), { children: r, items: i = [], size: a = "middle", onRefresh: o } = e, s = o ? [{
|
|
661
660
|
key: "refresh",
|
|
662
661
|
label: n("toolbar.refresh"),
|
|
663
662
|
icon: /* @__PURE__ */ X(fe, {}),
|
|
@@ -670,10 +669,10 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
670
669
|
justifyContent: "flex-end",
|
|
671
670
|
gap: 8
|
|
672
671
|
},
|
|
673
|
-
children: [r || null, /* @__PURE__ */ X(
|
|
672
|
+
children: [r || null, /* @__PURE__ */ X(L, {
|
|
674
673
|
menu: { items: s },
|
|
675
674
|
trigger: ["click"],
|
|
676
|
-
children: /* @__PURE__ */ X(
|
|
675
|
+
children: /* @__PURE__ */ X(M, {
|
|
677
676
|
loading: t,
|
|
678
677
|
size: a,
|
|
679
678
|
color: "default",
|
|
@@ -683,16 +682,16 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
683
682
|
})
|
|
684
683
|
})]
|
|
685
684
|
});
|
|
686
|
-
},
|
|
687
|
-
let { t, loading: n, permissions: r } =
|
|
688
|
-
return !i || !r.canDelete ? null : /* @__PURE__ */ X(
|
|
685
|
+
}, Be = (e) => {
|
|
686
|
+
let { t, loading: n, permissions: r } = j(), { entity: i, icon: a, type: o = "primary", showLabel: s = !1, disabled: c, onDelete: l } = e;
|
|
687
|
+
return !i || !r.canDelete ? null : /* @__PURE__ */ X(ee, {
|
|
689
688
|
title: t("actions.confirm.delete"),
|
|
690
689
|
onConfirm: () => l?.(i),
|
|
691
690
|
okText: t("actions.delete"),
|
|
692
691
|
cancelText: t("actions.cancel"),
|
|
693
692
|
children: /* @__PURE__ */ X(W, {
|
|
694
693
|
title: t("actions.delete"),
|
|
695
|
-
children: /* @__PURE__ */ X(
|
|
694
|
+
children: /* @__PURE__ */ X(M, {
|
|
696
695
|
disabled: c || !r.canDelete,
|
|
697
696
|
loading: n,
|
|
698
697
|
danger: !0,
|
|
@@ -702,9 +701,9 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
702
701
|
})
|
|
703
702
|
})
|
|
704
703
|
});
|
|
705
|
-
},
|
|
706
|
-
let { t, loading: n, permissions: r } =
|
|
707
|
-
return !i || !r.canUpdate ? null : /* @__PURE__ */ X(
|
|
704
|
+
}, Ve = (e) => {
|
|
705
|
+
let { t, loading: n, permissions: r } = j(), { entity: i, type: o = "primary", showLabel: s = !1, onEdit: c } = e;
|
|
706
|
+
return !i || !r.canUpdate ? null : /* @__PURE__ */ X(M, {
|
|
708
707
|
disabled: !r.canUpdate,
|
|
709
708
|
loading: n,
|
|
710
709
|
type: o,
|
|
@@ -712,13 +711,13 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
712
711
|
onClick: () => c?.(i),
|
|
713
712
|
children: s && t("actions.edit")
|
|
714
713
|
});
|
|
715
|
-
},
|
|
714
|
+
}, He = (e) => /* @__PURE__ */ X("div", {
|
|
716
715
|
className: $.tagsWrapper,
|
|
717
716
|
children: e?.days.map((e, t) => /* @__PURE__ */ X(U, {
|
|
718
717
|
color: a.tags.volcano,
|
|
719
718
|
children: e
|
|
720
719
|
}, t))
|
|
721
|
-
}),
|
|
720
|
+
}), Ue = (e, t) => e?.type === "PERIOD" ? /* @__PURE__ */ X("div", {
|
|
722
721
|
className: $.tagsWrapper,
|
|
723
722
|
children: t?.days.map((t, n) => /* @__PURE__ */ X(U, {
|
|
724
723
|
color: a.tags.cyan,
|
|
@@ -730,13 +729,13 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
730
729
|
color: a.tags.gold,
|
|
731
730
|
children: e?.monthDay
|
|
732
731
|
}, "monthDay")
|
|
733
|
-
}),
|
|
732
|
+
}), We = (e, t, n) => /* @__PURE__ */ Z(Y, { children: [Ue(t, n), /* @__PURE__ */ X("div", {
|
|
734
733
|
className: $.tagsWrapper,
|
|
735
734
|
children: e?.months?.map((e, t) => /* @__PURE__ */ X(U, {
|
|
736
735
|
color: a.tags.magenta,
|
|
737
736
|
children: e
|
|
738
737
|
}, t))
|
|
739
|
-
})] }),
|
|
738
|
+
})] }), Ge = ({ status: e }) => {
|
|
740
739
|
switch (e) {
|
|
741
740
|
case g.ACTIVE: return /* @__PURE__ */ X(U, {
|
|
742
741
|
color: "success",
|
|
@@ -758,11 +757,11 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
758
757
|
children: e
|
|
759
758
|
});
|
|
760
759
|
}
|
|
761
|
-
},
|
|
760
|
+
}, Ke = (e) => e.map((e, t) => ({
|
|
762
761
|
...e,
|
|
763
762
|
idx: t + 1,
|
|
764
763
|
key: e.id
|
|
765
|
-
})),
|
|
764
|
+
})), qe = {
|
|
766
765
|
key: "idx",
|
|
767
766
|
title: /* @__PURE__ */ X(ce, {}),
|
|
768
767
|
dataIndex: "idx",
|
|
@@ -770,25 +769,25 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
770
769
|
width: 70,
|
|
771
770
|
fixed: "left",
|
|
772
771
|
align: "center"
|
|
773
|
-
},
|
|
772
|
+
}, Je = (e = 100, t = "Actions") => ({
|
|
774
773
|
title: t,
|
|
775
774
|
key: "operation",
|
|
776
775
|
fixed: "right",
|
|
777
776
|
align: "center",
|
|
778
777
|
width: e
|
|
779
|
-
}),
|
|
778
|
+
}), Ye = (t, n = []) => {
|
|
780
779
|
let { disabled: r, schedulerType: i, currency: a, t: o, onEdit: s, onDelete: c } = t, l = s || c ? {
|
|
781
780
|
title: o("table.actions"),
|
|
782
781
|
key: "operation",
|
|
783
782
|
fixed: "right",
|
|
784
783
|
align: "center",
|
|
785
784
|
width: 100,
|
|
786
|
-
render: (e, t) => /* @__PURE__ */ Z("div", { children: [s && /* @__PURE__ */ X(
|
|
785
|
+
render: (e, t) => /* @__PURE__ */ Z("div", { children: [s && /* @__PURE__ */ X(Ve, {
|
|
787
786
|
onEdit: s,
|
|
788
787
|
disabled: r,
|
|
789
788
|
type: "text",
|
|
790
789
|
entity: t
|
|
791
|
-
}), c && /* @__PURE__ */ X(
|
|
790
|
+
}), c && /* @__PURE__ */ X(Be, {
|
|
792
791
|
onDelete: c,
|
|
793
792
|
icon: /* @__PURE__ */ X(oe, { twoToneColor: "#eb2f96" }),
|
|
794
793
|
type: "text",
|
|
@@ -804,7 +803,7 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
804
803
|
return t ? t.type === "PERCENT" ? `${t.value}${e[t.type]}` : T(t.value, a ?? "USD") : "—";
|
|
805
804
|
}
|
|
806
805
|
} : null, d = [
|
|
807
|
-
|
|
806
|
+
qe,
|
|
808
807
|
{
|
|
809
808
|
title: o("scheduler.meta.duration"),
|
|
810
809
|
dataIndex: "duration",
|
|
@@ -820,9 +819,9 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
820
819
|
render(e, t) {
|
|
821
820
|
let { duration: n, repeat: r } = t, { weekly: i, monthly: a, yearly: o } = r;
|
|
822
821
|
switch (n?.type) {
|
|
823
|
-
case "WEEK": return
|
|
824
|
-
case "MONTH": return
|
|
825
|
-
case "YEAR": return
|
|
822
|
+
case "WEEK": return He(i);
|
|
823
|
+
case "MONTH": return Ue(a, i);
|
|
824
|
+
case "YEAR": return We(o, a, i);
|
|
826
825
|
default: return /* @__PURE__ */ X(Y, {});
|
|
827
826
|
}
|
|
828
827
|
}
|
|
@@ -835,7 +834,7 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
835
834
|
width: 150,
|
|
836
835
|
align: "center",
|
|
837
836
|
concealable: !0,
|
|
838
|
-
render: (e) => /* @__PURE__ */ X(
|
|
837
|
+
render: (e) => /* @__PURE__ */ X(Ge, { status: e })
|
|
839
838
|
},
|
|
840
839
|
{
|
|
841
840
|
title: o("scheduler.updatedAt"),
|
|
@@ -844,32 +843,32 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
844
843
|
align: "center",
|
|
845
844
|
key: "metadata.updatedAt",
|
|
846
845
|
concealable: !0,
|
|
847
|
-
render: (e) => /* @__PURE__ */ X("div", { children: e?.updatedAt ?
|
|
846
|
+
render: (e) => /* @__PURE__ */ X("div", { children: e?.updatedAt ? k(e.updatedAt) : "—" })
|
|
848
847
|
},
|
|
849
848
|
l
|
|
850
849
|
].filter(Boolean);
|
|
851
850
|
return n.length ? d.filter((e) => n.includes(e?.dataIndex) || e.dataIndex === "idx") : d;
|
|
852
|
-
},
|
|
853
|
-
let { type: t, title: n, disabled: i, readOnlyFields: a = [], currency: s, onRefresh: c } = e, { schedulers: l, loading: d, limit: m = u, disabled: g, t: _, permissions: v, onUpdate: y, onDelete: b } =
|
|
854
|
-
|
|
855
|
-
},
|
|
851
|
+
}, Xe = (e) => {
|
|
852
|
+
let { type: t, title: n, disabled: i, readOnlyFields: a = [], currency: s, onRefresh: c } = e, { schedulers: l, loading: d, limit: m = u, disabled: g, t: _, permissions: v, onUpdate: y, onDelete: b } = j(), x = i ?? g, S = l[t] ?? [], [C, w] = J(/* @__PURE__ */ new Set()), [T, E] = J(!1), D = q(() => C.size === 0 ? S : S.filter((e) => !e.id || !C.has(e.id)), [S, C]), O = D.length >= m, [k] = R.useForm(), [M, N] = J(!1), [P, F] = J(null), L = q(() => [o, t], [t]), z = q(() => Object.keys(p), []), ee = q(() => Object.keys(f), []), B = (e) => {
|
|
853
|
+
F(e), N(!0);
|
|
854
|
+
}, te = async () => {
|
|
856
855
|
try {
|
|
857
|
-
await
|
|
858
|
-
let e =
|
|
859
|
-
...
|
|
856
|
+
await k.validateFields();
|
|
857
|
+
let e = k.getFieldValue(L), n = {
|
|
858
|
+
...P,
|
|
860
859
|
...e,
|
|
861
860
|
type: t,
|
|
862
861
|
[r]: t === h.SALE ? null : e?.[r]
|
|
863
862
|
};
|
|
864
|
-
y && await y(t, n),
|
|
863
|
+
y && await y(t, n), N(!1), F(null), k.resetFields(), c?.();
|
|
865
864
|
} catch {}
|
|
866
|
-
}, { filteredColumns:
|
|
865
|
+
}, { filteredColumns: V, columnsList: H, selectedColumns: U, setSelectedColumns: W } = A(Ye({
|
|
867
866
|
disabled: x,
|
|
868
867
|
schedulerType: t,
|
|
869
|
-
entities:
|
|
868
|
+
entities: D,
|
|
870
869
|
currency: s,
|
|
871
870
|
t: _,
|
|
872
|
-
onEdit: v.canUpdate ?
|
|
871
|
+
onEdit: v.canUpdate ? B : void 0,
|
|
873
872
|
onDelete: v.canDelete ? async (e) => {
|
|
874
873
|
if (e.id?.startsWith("new-")) {
|
|
875
874
|
w((t) => {
|
|
@@ -882,41 +881,39 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
882
881
|
} : void 0
|
|
883
882
|
}));
|
|
884
883
|
return /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(ne, {
|
|
885
|
-
columns:
|
|
884
|
+
columns: V,
|
|
886
885
|
loading: d,
|
|
887
886
|
scroll: { x: 1e3 },
|
|
888
887
|
bordered: !0,
|
|
889
888
|
className: $.gridList,
|
|
890
|
-
dataSource:
|
|
889
|
+
dataSource: Ke(D),
|
|
891
890
|
rowKey: (e) => e.id ?? `row-${Math.random()}`,
|
|
892
891
|
title: () => /* @__PURE__ */ X("div", {
|
|
893
892
|
className: $.gridHeader,
|
|
894
|
-
children: /* @__PURE__ */ X(
|
|
893
|
+
children: /* @__PURE__ */ X(ze, {
|
|
895
894
|
onRefresh: c,
|
|
896
|
-
items: v.canCreate && !
|
|
897
|
-
label: /* @__PURE__ */ X(
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
isCreating: D || d,
|
|
901
|
-
setIsCreating: ee,
|
|
895
|
+
items: v.canCreate && !O ? [{
|
|
896
|
+
label: /* @__PURE__ */ X(Le, {
|
|
897
|
+
isCreating: T || d,
|
|
898
|
+
setIsCreating: E,
|
|
902
899
|
schedulerType: t,
|
|
903
|
-
disabled: x ||
|
|
900
|
+
disabled: x || O,
|
|
904
901
|
onSuccess: () => c?.()
|
|
905
902
|
}),
|
|
906
903
|
icon: /* @__PURE__ */ X(de, {})
|
|
907
904
|
}] : [],
|
|
908
|
-
children: /* @__PURE__ */ X(
|
|
909
|
-
columnsList:
|
|
910
|
-
selectedColumns:
|
|
911
|
-
onChange:
|
|
905
|
+
children: /* @__PURE__ */ X(Re, {
|
|
906
|
+
columnsList: H,
|
|
907
|
+
selectedColumns: U,
|
|
908
|
+
onChange: W
|
|
912
909
|
})
|
|
913
910
|
})
|
|
914
911
|
}),
|
|
915
912
|
footer: () => /* @__PURE__ */ X("div", {
|
|
916
913
|
className: $.gridFooter,
|
|
917
|
-
children: `Total ${
|
|
914
|
+
children: `Total ${D.length} items`
|
|
918
915
|
})
|
|
919
|
-
}), /* @__PURE__ */ X(
|
|
916
|
+
}), /* @__PURE__ */ X(I, {
|
|
920
917
|
title: /* @__PURE__ */ Z("div", {
|
|
921
918
|
style: {
|
|
922
919
|
display: "flex",
|
|
@@ -926,29 +923,29 @@ var _e = Object.create, ve = Object.defineProperty, ye = Object.getOwnPropertyDe
|
|
|
926
923
|
children: [/* @__PURE__ */ X(me, {}), n ?? _("scheduler")]
|
|
927
924
|
}),
|
|
928
925
|
size: 600,
|
|
929
|
-
open:
|
|
926
|
+
open: M,
|
|
927
|
+
destroyOnHidden: !0,
|
|
930
928
|
onClose: () => {
|
|
931
|
-
|
|
929
|
+
N(!1), F(null);
|
|
932
930
|
},
|
|
933
|
-
extra: /* @__PURE__ */ X(
|
|
931
|
+
extra: /* @__PURE__ */ X(Ie, {
|
|
934
932
|
size: "small",
|
|
935
|
-
isEdit: !!
|
|
936
|
-
loading: d ||
|
|
937
|
-
disabled: x ||
|
|
938
|
-
onClick:
|
|
933
|
+
isEdit: !!P,
|
|
934
|
+
loading: d || T,
|
|
935
|
+
disabled: x || O,
|
|
936
|
+
onClick: te
|
|
939
937
|
}),
|
|
940
|
-
children:
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
entity: I,
|
|
938
|
+
children: M && /* @__PURE__ */ X(Fe, {
|
|
939
|
+
formRef: k,
|
|
940
|
+
prefix: L,
|
|
941
|
+
entity: P,
|
|
945
942
|
schedulerType: t,
|
|
946
|
-
durationTypes:
|
|
947
|
-
discountTypes:
|
|
943
|
+
durationTypes: z,
|
|
944
|
+
discountTypes: ee,
|
|
948
945
|
disabled: x,
|
|
949
946
|
readOnlyFields: a
|
|
950
947
|
})
|
|
951
948
|
})] });
|
|
952
949
|
};
|
|
953
950
|
//#endregion
|
|
954
|
-
export {
|
|
951
|
+
export { Fe as Scheduler, Le as SchedulerDrawerButton, Xe as SchedulersList, Je as actionField, qe as indexColumn, Ke as indexable };
|