@arcgis/portal-components 5.0.0-next.1 → 5.0.0-next.11

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.
Files changed (41) hide show
  1. package/dist/cdn/{TBZVZ3NK.js → 3CVUNHTA.js} +2 -2
  2. package/dist/cdn/{YKLWML27.js → DBMF5ITG.js} +1 -1
  3. package/dist/cdn/{YXRYHZH5.js → DX5BPMJT.js} +1 -1
  4. package/dist/cdn/{36SCONH7.js → GOKJITNU.js} +1 -1
  5. package/dist/cdn/JP7TWM5C.js +4 -0
  6. package/dist/cdn/{QXPXCLIB.js → KWTI237N.js} +2 -2
  7. package/dist/cdn/{OHA5XBKC.js → LZUP5EZ4.js} +2 -2
  8. package/dist/cdn/MVTC5ZD6.js +4 -0
  9. package/dist/cdn/QFO3SJJB.js +4 -0
  10. package/dist/cdn/{UAMIU7I6.js → UIE3JFL6.js} +2 -2
  11. package/dist/cdn/{M5TSWZEI.js → V3MB3BKX.js} +2 -2
  12. package/dist/cdn/{UYHDCO7W.js → YMNDATMC.js} +2 -2
  13. package/dist/cdn/index.js +2 -2
  14. package/dist/chunks/common.js +1 -1
  15. package/dist/chunks/fieldAddDelete.js +139 -148
  16. package/dist/chunks/loadClassificationData.js +1 -1
  17. package/dist/chunks/requests.js +1 -1
  18. package/dist/chunks/runtime.js +1 -1
  19. package/dist/chunks/useT9n.js +1 -1
  20. package/dist/components/arcgis-portal-classification-banner/customElement.js +1 -1
  21. package/dist/components/arcgis-portal-classification-config/customElement.d.ts +1 -1
  22. package/dist/components/arcgis-portal-classification-config/customElement.js +111 -103
  23. package/dist/components/arcgis-portal-classification-favorite/customElement.js +1 -1
  24. package/dist/components/arcgis-portal-classification-form-element/customElement.d.ts +2 -1
  25. package/dist/components/arcgis-portal-classification-form-element/customElement.js +12 -12
  26. package/dist/components/arcgis-portal-field-delete/customElement.js +62 -57
  27. package/dist/controllers/useClassificationModel.d.ts +1 -1
  28. package/dist/docs/api.json +19 -3
  29. package/dist/docs/docs.json +27 -5
  30. package/dist/docs/web-types.json +7 -3
  31. package/dist/index.js +1 -1
  32. package/dist/loader.js +2 -2
  33. package/dist/types/lumina.d.ts +1 -1
  34. package/dist/types/preact.d.ts +1 -1
  35. package/dist/types/preact10.d.ts +1 -1
  36. package/dist/types/react.d.ts +1 -1
  37. package/dist/types/stencil.d.ts +1 -1
  38. package/package.json +5 -5
  39. package/dist/cdn/3C7EKA4P.js +0 -4
  40. package/dist/cdn/MMZ2SLQM.js +0 -4
  41. package/dist/cdn/VUHRSXSV.js +0 -4
@@ -1,135 +1,135 @@
1
1
  import { c as g } from "../../chunks/runtime.js";
2
2
  import { LitElement as b, nothing as C } from "@arcgis/lumina";
3
3
  import { css as v, html as n } from "lit";
4
- import { Task as E, TaskStatus as y } from "@lit/task";
5
- import { createRef as x, ref as I } from "lit/directives/ref.js";
4
+ import { Task as E, TaskStatus as I } from "@lit/task";
5
+ import { createRef as y, ref as x } from "lit/directives/ref.js";
6
6
  import { usePropertyChange as w } from "@arcgis/lumina/controllers";
7
- import { getClosestElement as $ } from "@arcgis/toolkit/dom";
8
- import { u as P, c as S } from "../../chunks/loadClassificationData.js";
9
- import { createArcadeExecutor as V } from "@arcgis/core/arcade.js";
10
- import { u as O } from "../../chunks/useT9n.js";
11
- import { d as h, a as d, g as R, r as m, c as A, b as _ } from "../../chunks/common.js";
12
- import { watch as F } from "@arcgis/core/core/reactiveUtils.js";
7
+ import { getClosestElement as R } from "@arcgis/toolkit/dom";
8
+ import { u as $, c as S } from "../../chunks/loadClassificationData.js";
9
+ import { createArcadeExecutor as P } from "@arcgis/core/arcade.js";
10
+ import { u as V } from "../../chunks/useT9n.js";
11
+ import { d as f, a as d, g as O, r as u, c as A, b as F } from "../../chunks/common.js";
12
+ import { watch as _ } from "@arcgis/core/core/reactiveUtils.js";
13
13
  import { r as D } from "../../chunks/requests.js";
14
14
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
15
15
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
16
- v5.0.0-next.1 */
16
+ v5.0.0-next.11 */
17
17
  async function T({
18
- portalClassificationSchema: s,
18
+ portalClassificationSchema: a,
19
19
  itemClassification: t
20
20
  }) {
21
- const i = Object.entries(s.attributes).map(async ([a]) => {
22
- const r = await j(a, s, t);
23
- return { [a]: { enabled: r } };
21
+ const i = Object.entries(a.attributes).map(async ([s]) => {
22
+ const r = await q(s, a, t);
23
+ return { [s]: { enabled: r } };
24
24
  }), e = await Promise.all(i);
25
25
  return Object.assign({}, ...e);
26
26
  }
27
- async function j(s, t, i) {
28
- const e = t?.attributes?.[s];
27
+ async function q(a, t, i) {
28
+ const e = t?.attributes?.[a];
29
29
  if (!e)
30
30
  return !1;
31
- const { isAttributeEnabled: a } = e;
32
- return a ? await f(
33
- a,
31
+ const { isAttributeEnabled: s } = e;
32
+ return s ? await h(
33
+ s,
34
34
  JSON.stringify(t),
35
35
  i
36
36
  ) : !0;
37
37
  }
38
- async function M({
39
- portalClassificationSchema: s,
38
+ async function j({
39
+ portalClassificationSchema: a,
40
40
  itemClassification: t
41
41
  }) {
42
- const i = Object.entries(s.attributes).map(async ([a]) => {
43
- const r = await N(a, s, t);
44
- return { [a]: { valueExpressionResult: r } };
42
+ const i = Object.entries(a.attributes).map(async ([s]) => {
43
+ const r = await M(s, a, t);
44
+ return { [s]: { valueExpressionResult: r } };
45
45
  }), e = await Promise.all(i);
46
46
  return Object.assign({}, ...e);
47
47
  }
48
- async function N(s, t, i) {
49
- const e = t.attributes[s];
48
+ async function M(a, t, i) {
49
+ const e = t.attributes[a];
50
50
  if (!e)
51
- throw Error(`Attribute ${s} not found in schema`);
52
- const a = e.valueExpression, r = e.validValues, o = e.validValuesMap;
53
- return r?.length ? r : o && Object.keys(o)?.length ? o : a ? await f(
54
- a,
51
+ throw Error(`Attribute ${a} not found in schema`);
52
+ const s = e.valueExpression, r = e.validValues, o = e.validValuesMap;
53
+ return r?.length ? r : o && Object.keys(o)?.length ? o : s ? await h(
54
+ s,
55
55
  t,
56
56
  i,
57
- s
57
+ a
58
58
  ) : null;
59
59
  }
60
- async function q({
61
- portalClassificationSchema: s,
60
+ async function N({
61
+ portalClassificationSchema: a,
62
62
  itemClassification: t
63
63
  }) {
64
- const i = Object.entries(s.attributes).map(async ([a]) => {
64
+ const i = Object.entries(a.attributes).map(async ([s]) => {
65
65
  const r = await H(
66
- a,
67
66
  s,
67
+ a,
68
68
  t
69
69
  );
70
- return { [a]: { attributeValidationResult: r } };
70
+ return { [s]: { attributeValidationResult: r } };
71
71
  }), e = await Promise.all(i);
72
72
  return Object.assign({}, ...e);
73
73
  }
74
- async function H(s, t, i) {
75
- const e = t?.attributes?.[s];
74
+ async function H(a, t, i) {
75
+ const e = t?.attributes?.[a];
76
76
  if (!e)
77
77
  return null;
78
- const a = e?.attributeValidation;
79
- return a ? await f(
80
- a,
78
+ const s = e?.attributeValidation;
79
+ return s ? await h(
80
+ s,
81
81
  JSON.stringify(t),
82
82
  i,
83
- s
83
+ a
84
84
  ) : null;
85
85
  }
86
- const u = async (s, t) => {
87
- const i = s?.bannerExpression;
88
- return i?.length ? await f(
86
+ const m = async (a, t) => {
87
+ const i = a?.bannerExpression;
88
+ return i?.length ? await h(
89
89
  i,
90
- s,
90
+ a,
91
91
  t
92
- ) : k(s, t);
93
- }, k = (s, t) => {
94
- const i = Object.entries(s.attributes).sort(
92
+ ) : U(a, t);
93
+ }, U = (a, t) => {
94
+ const i = Object.entries(a.attributes).sort(
95
95
  ([, o], [, l]) => (o?.bannerOrder ?? 0) - (l?.bannerOrder ?? 0)
96
- ), e = [], a = [];
96
+ ), e = [], s = [];
97
97
  return i.forEach(([o, l]) => {
98
98
  const c = t?.[o];
99
99
  c && l.bannerOrder && (e.push(
100
- U({
100
+ L({
101
101
  elementType: l.uiElement ?? "",
102
102
  selectionDisplayLabel: l.bannerLabel ?? "",
103
103
  labelDelimiter: l.labelDelimiter ?? "",
104
104
  classificationProp: c,
105
105
  valueDelimiter: l.valueDelimiter ?? ""
106
106
  })
107
- ), a.push(l.attributeDelimiter ?? ""));
107
+ ), s.push(l.attributeDelimiter ?? ""));
108
108
  }), e.length > 0 ? e.reduce(
109
- (o, l, c) => c === 0 ? l : `${o}${a[c - 1]}${l}`,
109
+ (o, l, c) => c === 0 ? l : `${o}${s[c - 1]}${l}`,
110
110
  // avoiding to have delimiter at the start
111
111
  ""
112
112
  ) : "";
113
- }, U = ({
114
- elementType: s,
113
+ }, L = ({
114
+ elementType: a,
115
115
  selectionDisplayLabel: t,
116
116
  labelDelimiter: i,
117
117
  classificationProp: e,
118
- valueDelimiter: a
118
+ valueDelimiter: s
119
119
  }) => {
120
- const r = s.includes("multi") && e ? e.split("").join(a) : e;
120
+ const r = a.includes("multi") && e ? e.split("").join(s) : e;
121
121
  return `${t}${i}${r}`;
122
122
  };
123
- async function f(s, t, i, e = "") {
124
- const a = {
123
+ async function h(a, t, i, e = "") {
124
+ const s = {
125
125
  schemaJsonString: typeof t == "string" ? t : JSON.stringify(t),
126
126
  valueJsonString: JSON.stringify(i),
127
127
  attributeId: e
128
128
  };
129
- return (await L(s)).execute(a);
129
+ return (await B(a)).execute(s);
130
130
  }
131
- async function L(s) {
132
- return await V(s, {
131
+ async function B(a) {
132
+ return await P(a, {
133
133
  variables: [
134
134
  {
135
135
  name: "schemaJsonString",
@@ -146,23 +146,23 @@ async function L(s) {
146
146
  ]
147
147
  });
148
148
  }
149
- const B = v`:host{height:100%;box-sizing:border-box;display:flex;flex-direction:column}.header-section{padding:var(--calcite-spacing-sm)}.header-section__title-container{display:flex;align-items:center;justify-content:space-between}.header-section__title-text{margin:unset;font-weight:unset;font-size:var(--calcite-font-size)}.header-section__title-popover{padding:var(--calcite-spacing-md)}.form-section{display:flex;border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);padding:var(--calcite-spacing-sm);height:100%;overflow:hidden}.form-section__sidebar{flex:1;padding:var(--calcite-spacing-sm)}.form-section__main-content{flex:3;padding:var(--calcite-spacing-sm);overflow:auto}.danger{color:var(--calcite-color-status-danger)}.spacing-y{margin:var(--calcite-spacing-md) 0}`;
150
- class J extends b {
149
+ const J = v`:host{height:100%;box-sizing:border-box;display:flex;flex-direction:column}.header-section{padding:var(--calcite-spacing-sm)}.header-section__title-container{display:flex;align-items:center;justify-content:space-between}.header-section__title-text{margin:unset;font-weight:unset;font-size:var(--calcite-font-size)}.header-section__title-popover{padding:var(--calcite-spacing-md)}.form-section{display:flex;border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);padding:var(--calcite-spacing-sm);height:100%;overflow:hidden}.form-section__sidebar{flex:1;padding:var(--calcite-spacing-sm)}.form-section__main-content{flex:3;padding:var(--calcite-spacing-sm);overflow:auto}.danger{color:var(--calcite-color-status-danger)}.spacing-y{margin:var(--calcite-spacing-md) 0}`;
150
+ class W extends b {
151
151
  constructor() {
152
- super(), this.classificationModel = P(this), this.messages = O(), this.formMainContentRef = x(), this._classificationDataTask = S(this), this._formCreationTask = new E(this, {
152
+ super(), this.classificationModel = $(this), this.messages = V(), this.formMainContentRef = y(), this._classificationDataTask = S(this), this._formCreationTask = new E(this, {
153
153
  task: async () => {
154
154
  if (await this._classificationDataTask.taskComplete, !this.portalClassificationSchema || !this.portalItem)
155
155
  throw new Error("Portal item and classification schema are required to render the form");
156
156
  const t = this.portalItem.clone();
157
157
  if (await t.load(), !this.primaryAttribute)
158
158
  throw new Error("primaryAttribute is required but was undefined.");
159
- this.existingClassification = !!t.classification, t.classification = h(t.classification, this.primaryAttribute, this.portalClassificationSchema), t.classification && (t.classification.banner = await u(this.portalClassificationSchema, t.classification)), this.pendingPortalItem = t, this._itemClassificationWatchHandle && (this._itemClassificationWatchHandle.remove(), this.portalItem.removeHandles("arcgis-classification-config"), this._itemClassificationWatchHandle = void 0), this._itemClassificationWatchHandle = F(() => this.portalItem.classification, (i) => {
159
+ this.existingClassification = !!t.classification, t.classification = f(t.classification, this.primaryAttribute, this.portalClassificationSchema), t.classification && (t.classification.banner = await m(this.portalClassificationSchema, t.classification)), this.pendingPortalItem = t, this._itemClassificationWatchHandle && (this._itemClassificationWatchHandle.remove(), this.portalItem.removeHandles("arcgis-classification-config"), this._itemClassificationWatchHandle = void 0), this._itemClassificationWatchHandle = _(() => this.portalItem.classification, (i) => {
160
160
  if (this.pendingPortalItem) {
161
161
  const e = this.pendingPortalItem.clone();
162
162
  e.load().then(() => {
163
163
  e.classification = i, this.pendingPortalItem = e;
164
- }).catch((a) => {
165
- console.error(a);
164
+ }).catch((s) => {
165
+ console.error(s);
166
166
  });
167
167
  }
168
168
  }), this.portalItem.addHandles(this._itemClassificationWatchHandle, "arcgis-classification-config"), await this.evaluateAttributeExpressions(this.portalClassificationSchema, this.pendingPortalItem), this.pendingPortalItem.classification = d(this.pendingPortalItem.classification, this.attributeExpressionResults), this.existingClassification && this.validateForm();
@@ -171,7 +171,7 @@ class J extends b {
171
171
  }), this.getFormDisplayOrder = (t) => this.portalClassificationSchema?.layouts.default.layoutElements[t].formDisplayOrder ?? 0, this.addEditInfoAttributes = () => {
172
172
  if (!this.pendingPortalItem?.classification)
173
173
  return {};
174
- const t = structuredClone(this.pendingPortalItem.classification), i = R(this.pendingPortalItem, t);
174
+ const t = structuredClone(this.pendingPortalItem.classification), i = O(this.pendingPortalItem, t);
175
175
  return { ...t, ...i };
176
176
  }, this.updateFavoriteClassification = (t) => {
177
177
  this.favoriteClassifications = t;
@@ -179,17 +179,17 @@ class J extends b {
179
179
  const i = t.classification;
180
180
  if (this.selectedFavoriteClassificationName = t.name, this.pendingPortalItem) {
181
181
  const e = this.pendingPortalItem.clone();
182
- if (await e.load(), e.classification = m(this.portalClassificationSchema, i), !this.portalClassificationSchema)
182
+ if (await e.load(), e.classification = u(this.portalClassificationSchema, i), !this.portalClassificationSchema)
183
183
  return;
184
184
  await this.evaluateAttributeExpressions(this.portalClassificationSchema, e), e.classification = d(e.classification, this.attributeExpressionResults), this.pendingPortalItem = e;
185
185
  }
186
- }, this.existingClassification = !1, this.portalClassificationSchema = this.classificationModel.portalClassificationSchema, this.primaryAttribute = this.classificationModel.primaryAttribute, this.attributeExpressionResults = /* @__PURE__ */ new Map(), this.formValidationErrors = [], this.remoteValidationErrors = "", this.canUserConfigureClassification = !0, this.favoriteClassifications = [], this.status = this.classificationModel.status, this.values = {}, this.valid = !1, this.autoDestroyDisabled = !1, this.arcgisPropertyChange = w()("status", "values", "valid");
186
+ }, this.existingClassification = !1, this.portalClassificationSchema = this.classificationModel.portalClassificationSchema, this.primaryAttribute = this.classificationModel.primaryAttribute, this.attributeExpressionResults = /* @__PURE__ */ new Map(), this.formValidationErrors = [], this.remoteValidationErrors = "", this.canUserConfigureClassification = !0, this.favoriteClassifications = [], this.isRequiredErrors = /* @__PURE__ */ new Set(), this.status = this.classificationModel.status, this.values = {}, this.valid = !1, this.autoDestroyDisabled = !1, this.arcgisPropertyChange = w()("status", "values", "valid");
187
187
  }
188
188
  static {
189
- this.properties = { existingClassification: 16, portalClassificationSchema: 16, primaryAttribute: 16, attributeExpressionResults: 16, formValidationErrors: 16, itemClassification: 16, pendingPortalItem: 16, selectedCategory: 16, remoteValidationErrors: 16, canUserConfigureClassification: 16, favoriteClassifications: 16, selectedFavoriteClassificationName: 16, portalItem: 0, status: 35, values: [1, { type: Object }], valid: 7, autoDestroyDisabled: 5 };
189
+ this.properties = { existingClassification: 16, portalClassificationSchema: 16, primaryAttribute: 16, attributeExpressionResults: 16, formValidationErrors: 16, itemClassification: 16, pendingPortalItem: 16, selectedCategory: 16, remoteValidationErrors: 16, canUserConfigureClassification: 16, favoriteClassifications: 16, selectedFavoriteClassificationName: 16, isRequiredErrors: 16, portalItem: 0, status: 35, values: [1, { type: Object }], valid: 7, autoDestroyDisabled: 5 };
190
190
  }
191
191
  static {
192
- this.styles = B;
192
+ this.styles = J;
193
193
  }
194
194
  async destroy() {
195
195
  await this.manager.destroy();
@@ -199,7 +199,7 @@ class J extends b {
199
199
  this.pendingPortalItem = this.portalItem?.clone(), this.portalClassificationSchema && this.pendingPortalItem && (await this.evaluateAttributeExpressions(this.portalClassificationSchema, this.pendingPortalItem), this.pendingPortalItem.classification = d(this.pendingPortalItem.classification, this.attributeExpressionResults), this.validateForm());
200
200
  else if (this.portalItem && this.primaryAttribute && this.portalClassificationSchema) {
201
201
  const t = this.portalItem.clone();
202
- await t.load(), this.pendingPortalItem = this.portalItem?.clone(), this.pendingPortalItem.classification = h(t.classification, this.primaryAttribute, this.portalClassificationSchema), this.portalClassificationSchema && this.pendingPortalItem && (await this.evaluateAttributeExpressions(this.portalClassificationSchema, this.pendingPortalItem), this.pendingPortalItem.classification = d(this.pendingPortalItem.classification, this.attributeExpressionResults));
202
+ await t.load(), this.pendingPortalItem = this.portalItem?.clone(), this.pendingPortalItem.classification = f(t.classification, this.primaryAttribute, this.portalClassificationSchema), this.portalClassificationSchema && this.pendingPortalItem && (await this.evaluateAttributeExpressions(this.portalClassificationSchema, this.pendingPortalItem), this.pendingPortalItem.classification = d(this.pendingPortalItem.classification, this.attributeExpressionResults));
203
203
  }
204
204
  }
205
205
  async validateForm() {
@@ -229,28 +229,28 @@ class J extends b {
229
229
  (t.has("formValidationErrors") || t.has("remoteValidationErrors")) && (this.valid = !this.formValidationErrors.length && !this.remoteValidationErrors);
230
230
  }
231
231
  loaded() {
232
- const t = $(this.el, "form");
232
+ const t = R(this.el, "form");
233
233
  t && (this.listenOn(t, "formdata", this.updateFormData), this.listenOn(t, "submit", this.handleFormSubmit)), this.listen("submit", this.handleFormSubmit);
234
234
  }
235
235
  async updateClassificationProperty(t) {
236
236
  if (!this.pendingPortalItem || !this.portalClassificationSchema)
237
237
  return;
238
238
  const i = this.pendingPortalItem.clone();
239
- await i.load(), Object.entries(t ?? {}).forEach(([e, a]) => {
239
+ await i.load(), Object.entries(t ?? {}).forEach(([e, s]) => {
240
240
  if (e === this.primaryAttribute) {
241
- let r = _(a, i.classification, this.primaryAttribute);
242
- r = m(this.portalClassificationSchema, r), i.classification = r;
241
+ let r = F(s, i.classification, this.primaryAttribute);
242
+ r = u(this.portalClassificationSchema, r), i.classification = r;
243
243
  } else {
244
244
  const r = new Map(Object.entries(i.classification ?? {}));
245
- if (a === void 0 || a === "" || Array.isArray(a) && a.length === 0)
245
+ if (s === void 0 || s === "" || Array.isArray(s) && s.length === 0)
246
246
  r.delete(e);
247
- else if (r.set(e, a), e === "fgi" && !r.has("fgiOptions")) {
247
+ else if (r.set(e, s), e === "fgi" && !r.has("fgiOptions")) {
248
248
  const o = this.portalClassificationSchema?.attributes?.fgiOptions?.defaultValue ?? [];
249
249
  r.set("fgiOptions", Array.isArray(o) ? o : [o]);
250
250
  }
251
251
  i.classification = Object.fromEntries(r);
252
252
  }
253
- }), i.classification && !i.classification.fgi && delete i.classification.fgiOptions, await this.evaluateAttributeExpressions(this.portalClassificationSchema, i), i.classification = d(i.classification, this.attributeExpressionResults), i.classification && (i.classification.banner = await u(this.portalClassificationSchema, i.classification)), this.pendingPortalItem = i, this.existingClassification && this.validateForm();
253
+ }), i.classification && !i.classification.fgi && delete i.classification.fgiOptions, await this.evaluateAttributeExpressions(this.portalClassificationSchema, i), i.classification = d(i.classification, this.attributeExpressionResults), i.classification && (i.classification.banner = await m(this.portalClassificationSchema, i.classification)), this.pendingPortalItem = i, this.existingClassification && this.validateForm(), t && "classification" in t && this.updateIsRequiredErrors();
254
254
  }
255
255
  handleCategorySelectChange(t) {
256
256
  this.selectedCategory = t.target.selectedItems[0].value;
@@ -259,35 +259,41 @@ class J extends b {
259
259
  const e = await T({
260
260
  portalClassificationSchema: t,
261
261
  itemClassification: i.classification
262
- }), a = await M({
262
+ }), s = await j({
263
263
  portalClassificationSchema: t,
264
264
  itemClassification: i.classification
265
- }), r = await q({
265
+ }), r = await N({
266
266
  portalClassificationSchema: t,
267
267
  itemClassification: i.classification
268
268
  });
269
269
  Object.keys(t.attributes).forEach((o) => {
270
- const l = e[o]?.enabled ?? !0, c = a[o]?.valueExpressionResult, p = r[o]?.attributeValidationResult;
270
+ const l = e[o]?.enabled ?? !0, c = s[o]?.valueExpressionResult, p = r[o]?.attributeValidationResult;
271
271
  this.attributeExpressionResults.set(o, { enabled: l, valueExpressionResult: c, attributeValidationResult: p });
272
272
  });
273
273
  }
274
- updateFormValidationErrors() {
275
- const t = [];
274
+ updateIsRequiredErrors() {
275
+ const t = /* @__PURE__ */ new Set();
276
276
  Object.entries(this.portalClassificationSchema?.attributes ?? {})?.forEach(([i, e]) => {
277
- e.isRequired && /**
277
+ e.isRequired && !this.pendingPortalItem?.classification?.[i] && this.pendingPortalItem?.classification?.[i] !== 0 && t.add(i);
278
+ }), this.isRequiredErrors = t;
279
+ }
280
+ updateFormValidationErrors(t = !1) {
281
+ const i = [];
282
+ Object.entries(this.portalClassificationSchema?.attributes ?? {})?.forEach(([e, s]) => {
283
+ s.isRequired && /**
278
284
  * Because of the logic in updateClassificationProperty (we delete keys instead of setting falsy values),
279
285
  * we can assume that the classification property will not have valid falsy values beyond zero.
280
286
  */
281
- !this.pendingPortalItem?.classification?.[i] && this.pendingPortalItem?.classification?.[i] !== 0 && t.push({
282
- attribute: e.label,
287
+ !this.pendingPortalItem?.classification?.[e] && this.pendingPortalItem?.classification?.[e] !== 0 && (!t || this.isRequiredErrors.has(e)) && i.push({
288
+ attribute: s.label,
283
289
  reason: this.messages.isrequired ?? "is required",
284
- category: e.attributeCategory
285
- }), this.attributeExpressionResults.get(i)?.attributeValidationResult && t.push({
286
- attribute: e.label,
287
- reason: this.attributeExpressionResults.get(i)?.attributeValidationResult ?? "",
288
- category: e.attributeCategory
290
+ category: s.attributeCategory
291
+ }), this.attributeExpressionResults.get(e)?.attributeValidationResult && i.push({
292
+ attribute: s.label,
293
+ reason: this.attributeExpressionResults.get(e)?.attributeValidationResult ?? "",
294
+ category: s.attributeCategory
289
295
  });
290
- }), this.formValidationErrors = t;
296
+ }), this.formValidationErrors = i;
291
297
  }
292
298
  async updateRemoteValidationErrors() {
293
299
  if (!this.pendingPortalItem?.classification)
@@ -301,13 +307,13 @@ class J extends b {
301
307
  this.remoteValidationErrors = t;
302
308
  }
303
309
  async handleFormSubmit(t) {
304
- this.validateForm(), this.formMainContentRef.value?.scrollIntoView();
310
+ this.validateForm(), this.updateIsRequiredErrors(), this.formMainContentRef.value?.scrollIntoView();
305
311
  }
306
312
  updateFormData(t) {
307
313
  const i = t.formData;
308
314
  let e = this.addEditInfoAttributes();
309
- e = d(e, this.attributeExpressionResults), Object.entries(e ?? {}).forEach(([a, r]) => {
310
- i.set(a, r);
315
+ e = d(e, this.attributeExpressionResults), Object.entries(e ?? {}).forEach(([s, r]) => {
316
+ i.set(s, r);
311
317
  });
312
318
  }
313
319
  renderCategoryTabs() {
@@ -327,7 +333,7 @@ class J extends b {
327
333
  renderFavoriteClassification() {
328
334
  const t = this.portalClassificationSchema?.attributeCategories?.[0] ?? "Default";
329
335
  return this.selectedCategory = this.portalClassificationSchema?.attributeCategories?.length ? this.selectedCategory : "Default", this.selectedCategory === t ? n`<arcgis-portal-classification-favorite .portalItem=${this.pendingPortalItem ?? this.portalItem} .classificationValue=${this.pendingPortalItem?.classification} .favoriteClassifications=${this.favoriteClassifications} .selectedFavoriteClassificationName=${this.selectedFavoriteClassificationName} .attributeExpressionResults=${this.attributeExpressionResults} .resetFavoriteClassification=${(i) => this.updateFavoriteClassification(i)} .updateClassificationData=${async (i) => {
330
- await this.updateClassificationData(i), this.updateFormValidationErrors();
336
+ await this.updateClassificationData(i), this.updateFormValidationErrors(), this.updateIsRequiredErrors();
331
337
  }}></arcgis-portal-classification-favorite>` : null;
332
338
  }
333
339
  renderForm() {
@@ -340,8 +346,10 @@ class J extends b {
340
346
  return n`${this.renderValidationErrors()}${this.renderFavoriteClassification()}${t.filter(([, { attributeCategory: i }]) => this.selectedCategory === i || !i).map(([i, e]) => {
341
347
  if (this.attributeExpressionResults.get(i)?.enabled === !1)
342
348
  return null;
343
- const a = this.pendingPortalItem?.classification?.[i];
344
- return n`<arcgis-portal-classification-form-element .attributeKey=${i} .attribute=${e} .value=${a} @arcgisAttributeValueChange=${(r) => void this.updateClassificationProperty(r.detail)} .renderingInfo=${this.attributeExpressionResults.get(i)}></arcgis-portal-classification-form-element>`;
349
+ const s = this.pendingPortalItem?.classification?.[i];
350
+ return n`<arcgis-portal-classification-form-element .attributeKey=${i} .attribute=${e} .value=${s} @arcgisAttributeValueChange=${async (r) => {
351
+ await this.updateClassificationProperty(r.detail), e.isRequired && !r.detail[i] ? this.isRequiredErrors.add(i) : this.isRequiredErrors = new Set(Array.from(this.isRequiredErrors).filter((o) => o !== i)), this.updateFormValidationErrors(!0);
352
+ }} .renderingInfo=${this.attributeExpressionResults.get(i)} .isRequiredErrors=${this.isRequiredErrors}></arcgis-portal-classification-form-element>`;
345
353
  })}`;
346
354
  }
347
355
  });
@@ -356,11 +364,11 @@ class J extends b {
356
364
  return this.portalItem ? this._classificationDataTask.render({
357
365
  pending: () => n`<calcite-loader .label=${this.messages.loading ?? "loading"}></calcite-loader>`,
358
366
  error: () => this.renderNotice(this.messages.anerroroccurred ?? "An error has occurred.", "danger"),
359
- complete: () => this.portalItem ? this.canUserConfigureClassification ? this.portalItem.portal.hasClassificationSchema ? n`<div class="header-section" role=region aria-label=${this.messages.documentbannerpreview ?? "documentbannerpreview" ?? C}><div class="header-section__title-container"><h2 class="header-section__title-text">${this.messages.documentbannerpreview ?? "documentbannerpreview"}</h2>${this.renderHelpTooltip()}</div>${this._formCreationTask.status === y.COMPLETE && n`<arcgis-portal-classification-banner .portalItem=${this.pendingPortalItem ?? this.portalItem} variant=preview .missingExistingClassification=${!this.existingClassification}></arcgis-portal-classification-banner>` || ""}</div><div class="form-section">${this.portalClassificationSchema?.attributeCategories?.length && n`<div class="form-section__sidebar">${this.renderCategoryTabs()}</div>` || ""}<div class="form-section__main-content" ${I(this.formMainContentRef)}>${this.renderForm()}</div></div>` : this.renderNotice(this.messages.missingclassificationschema ?? "Portal is missing classification schema.") : this.renderNotice(this.messages.userconfigurepermissionrequired ?? "User configuration permission is required.") : this.renderNotice(this.messages.portalitemrequired ?? "Portal item is required.")
367
+ complete: () => this.portalItem ? this.canUserConfigureClassification ? this.portalItem.portal.hasClassificationSchema ? n`<div class="header-section" role=region aria-label=${this.messages.documentbannerpreview ?? "documentbannerpreview" ?? C}><div class="header-section__title-container"><h2 class="header-section__title-text">${this.messages.documentbannerpreview ?? "documentbannerpreview"}</h2>${this.renderHelpTooltip()}</div>${this._formCreationTask.status === I.COMPLETE && n`<arcgis-portal-classification-banner .portalItem=${this.pendingPortalItem ?? this.portalItem} variant=preview .missingExistingClassification=${!this.existingClassification}></arcgis-portal-classification-banner>` || ""}</div><div class="form-section">${this.portalClassificationSchema?.attributeCategories?.length && n`<div class="form-section__sidebar">${this.renderCategoryTabs()}</div>` || ""}<div class="form-section__main-content" ${x(this.formMainContentRef)}>${this.renderForm()}</div></div>` : this.renderNotice(this.messages.missingclassificationschema ?? "Portal is missing classification schema.") : this.renderNotice(this.messages.userconfigurepermissionrequired ?? "User configuration permission is required.") : this.renderNotice(this.messages.portalitemrequired ?? "Portal item is required.")
360
368
  }) : this.renderNotice(this.messages.portalitemrequired ?? "Portal item is required.");
361
369
  }
362
370
  }
363
- g("arcgis-portal-classification-config", J);
371
+ g("arcgis-portal-classification-config", W);
364
372
  export {
365
- J as ArcgisPortalClassificationConfig
373
+ W as ArcgisPortalClassificationConfig
366
374
  };
@@ -7,7 +7,7 @@ import { u as d, r as v } from "../../chunks/requests.js";
7
7
  import { g as h } from "../../chunks/common.js";
8
8
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
9
9
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
10
- v5.0.0-next.1 */
10
+ v5.0.0-next.11 */
11
11
  const m = r`.select-favorite-label{display:flex;justify-content:space-between;align-items:center}.favorite-actions{display:flex;justify-content:flex-end;gap:1.5rem;align-items:center}.classification-favorite-dialog{--calcite-dialog-content-space: 0;--calcite-dialog-background-color: "var(--calcite-color-foreground-2)"}.save-new-favorite-button{display:flex;justify-content:flex-end;margin-top:.25rem;margin-bottom:1rem}.classification-favorite-item{display:flex;justify-content:space-between;padding-top:.5rem;padding-bottom:.5rem;border-bottom:1px solid var(--calcite-color-border-1)}.classification-favorite-list,.classification-favorite-input-section{margin:1.75rem 1rem}`;
12
12
  class C extends n {
13
13
  constructor() {
@@ -12,7 +12,8 @@ export declare class ArcgisPortalClassificationFormElement extends LitElement {
12
12
  attributeKey: string;
13
13
  attribute: ClassificationSchema["attributes"][string];
14
14
  value: unknown;
15
- renderingInfo: Pick<NonNullable<ReturnType<AttributeExpressionResults["get"]>>, "attributeValidationResult" | "valueExpressionResult">;
15
+ renderingInfo?: Pick<NonNullable<ReturnType<AttributeExpressionResults["get"]>>, "attributeValidationResult" | "valueExpressionResult">;
16
+ isRequiredErrors: Set<string>;
16
17
  /** The attribute value has changed. */
17
18
  readonly arcgisAttributeValueChange: TargetedEvent<this, Record<string, unknown>>;
18
19
  }
@@ -5,28 +5,28 @@ import { css as d, html as i } from "lit";
5
5
  import { u as h } from "../../chunks/useT9n.js";
6
6
  /*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
7
7
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
8
- v5.0.0-next.1 */
8
+ v5.0.0-next.11 */
9
9
  const m = d`.spacing-y{margin:var(--calcite-spacing-md) 0}.portal-classification-form-element-tooltip{display:flex;justify-content:space-between;align-items:center}`;
10
10
  function l(n, e) {
11
11
  return n.uiElement === e;
12
12
  }
13
13
  class v extends c {
14
14
  constructor() {
15
- super(...arguments), this.messages = h(), this.arcgisAttributeValueChange = b();
15
+ super(...arguments), this.messages = h(), this.isRequiredErrors = /* @__PURE__ */ new Set(), this.arcgisAttributeValueChange = b();
16
16
  }
17
17
  static {
18
- this.properties = { validationMsg: 16, attributeKey: 1, attribute: 0, value: 0, renderingInfo: 0 };
18
+ this.properties = { validationMsg: 16, attributeKey: 1, attribute: 0, value: 0, renderingInfo: 0, isRequiredErrors: 0 };
19
19
  }
20
20
  static {
21
21
  this.styles = m;
22
22
  }
23
23
  willUpdate(e) {
24
- e.has("renderingInfo") && (this.validationMsg = this._getValidationMessage());
24
+ (e.has("renderingInfo") || e.has("isRequiredErrors")) && (this.validationMsg = this._getValidationMessage());
25
25
  }
26
26
  _getValidationMessage() {
27
- if (this.renderingInfo.attributeValidationResult)
27
+ if (this.renderingInfo?.attributeValidationResult)
28
28
  return this.renderingInfo.attributeValidationResult;
29
- if (this.attribute.isRequired && !this.value)
29
+ if (this.isRequiredErrors.has(this.attributeKey))
30
30
  return this.messages.requiredfield ?? "This is a required field.";
31
31
  }
32
32
  renderCheckbox() {
@@ -45,16 +45,16 @@ class v extends c {
45
45
  return l(this.attribute, "single-select") ? i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox selection-mode=single id=${this.attributeKey ?? a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${(e) => this.arcgisAttributeValueChange.emit({ [this.attributeKey]: e.target.value })} .placeholder=${this.attribute.description ?? this.messages.selectanoption} .required=${this.attribute.isRequired} .status=${this.validationMsg ? "invalid" : "valid"} overlay-positioning=fixed validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value} data-testid=${`single-select-${this.attributeKey}`}>${this._renderSingleSelectComboboxOptions()}</calcite-combobox></calcite-label>` : null;
46
46
  }
47
47
  _renderSingleSelectComboboxOptions() {
48
- if (!Array.isArray(this.renderingInfo.valueExpressionResult))
48
+ if (!Array.isArray(this.renderingInfo?.valueExpressionResult))
49
49
  return;
50
50
  const e = this.value;
51
- return u(this.renderingInfo.valueExpressionResult, (t) => t.label, (t) => i`<calcite-combobox-item .selected=${e === t.value} text-label=${t.label ?? a} .value=${t.value} data-testid=${`single-combobox-item-${t.value}`}></calcite-combobox-item>`);
51
+ return u(this.renderingInfo?.valueExpressionResult, (t) => t.label, (t) => i`<calcite-combobox-item .selected=${e === t.value} text-label=${t.label ?? a} .value=${t.value} data-testid=${`single-combobox-item-${t.value}`}></calcite-combobox-item>`);
52
52
  }
53
53
  _renderComboboxOptions() {
54
- if (!Array.isArray(this.renderingInfo.valueExpressionResult))
54
+ if (!Array.isArray(this.renderingInfo?.valueExpressionResult))
55
55
  return;
56
56
  const e = this.value;
57
- return this.renderingInfo.valueExpressionResult.map((t) => i`<calcite-combobox-item .selected=${e?.includes(t.value)} text-label=${t.label ?? a} .value=${t.value} data-testid=${`combobox-item-${t.value}`}></calcite-combobox-item>`);
57
+ return this.renderingInfo?.valueExpressionResult.map((t) => i`<calcite-combobox-item .selected=${e?.includes(t.value)} text-label=${t.label ?? a} .value=${t.value} data-testid=${`combobox-item-${t.value}`}></calcite-combobox-item>`);
58
58
  }
59
59
  renderMultiSelect() {
60
60
  return l(this.attribute, "multi-select") ? i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey ?? a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${(e) => {
@@ -65,10 +65,10 @@ class v extends c {
65
65
  }} .placeholder=${this.attribute.description ?? this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg ? "invalid" : "valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderComboboxOptions()}</calcite-combobox></calcite-label>` : null;
66
66
  }
67
67
  _renderGroupedComboboxOptions() {
68
- if (!this.renderingInfo.valueExpressionResult || Array.isArray(this.renderingInfo.valueExpressionResult))
68
+ if (!this.renderingInfo?.valueExpressionResult || Array.isArray(this.renderingInfo?.valueExpressionResult))
69
69
  return;
70
70
  const e = this.value;
71
- return Object.entries(this.renderingInfo.valueExpressionResult).map(([t, s]) => i`<calcite-combobox-item .selected=${e?.includes(t)} text-label=${t ?? a} .value=${t}>${s.map((r) => i`<calcite-combobox-item .selected=${e?.includes(r.value)} text-label=${r.label ?? a} .value=${r.value} data-testid=${`grouped-combobox-item-${r.value}`}></calcite-combobox-item>`)}</calcite-combobox-item>`);
71
+ return Object.entries(this.renderingInfo?.valueExpressionResult).map(([t, s]) => i`<calcite-combobox-item .selected=${e?.includes(t)} text-label=${t ?? a} .value=${t}>${s.map((r) => i`<calcite-combobox-item .selected=${e?.includes(r.value)} text-label=${r.label ?? a} .value=${r.value} data-testid=${`grouped-combobox-item-${r.value}`}></calcite-combobox-item>`)}</calcite-combobox-item>`);
72
72
  }
73
73
  renderMultiGroupedSelectNested() {
74
74
  return l(this.attribute, "multi-grouped-select-nested") ? i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey ?? a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${(e) => {