@things-factory/learning 10.1.268 → 10.1.269

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.
@@ -1,3 +1,4 @@
1
+ import '@operato/input/ox-input-date.js';
1
2
  import '@material/web/button/filled-button.js';
2
3
  import '@material/web/button/text-button.js';
3
4
  import '@operato/popup/ox-popup-actions.js';
@@ -1,4 +1,5 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
+ import '@operato/input/ox-input-date.js';
2
3
  import '@material/web/button/filled-button.js';
3
4
  import '@material/web/button/text-button.js';
4
5
  import '@operato/popup/ox-popup-actions.js';
@@ -40,7 +41,7 @@ let LearningAssignForm = class LearningAssignForm extends localize(i18next)(LitE
40
41
  </div>
41
42
  <label class="field">
42
43
  <span>${t('field.learning-due-on')}</span>
43
- <input type="date" .value=${this.dueOn} @input=${(e) => (this.dueOn = e.target.value)} />
44
+ <ox-input-date type="date" .value=${this.dueOn} @change=${(e) => (this.dueOn = e.target.value)}></ox-input-date>
44
45
  <span>${t('text.learning-due-on-hint')}</span>
45
46
  </label>
46
47
  ${error ? html `<div class="field"><span invalid role="alert">${error.graphQLErrors?.[0]?.message ?? error.message}</span></div>` : nothing}
@@ -1 +1 @@
1
- {"version":3,"file":"learning-assign-form.js","sourceRoot":"","sources":["../../client/components/learning-assign-form.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,qCAAqC,CAAA;AAC5C,OAAO,oCAAoC,CAAA;AAC3C,OAAO,0CAA0C,CAAA;AAEjD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,Q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,CAAC,CAAC,CAAA;QAC5G,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC,CAAA;QACtG,IAAI,IAAI;YAAE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IACjG,CAAC;;AAjC+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;kDAA4D;AAC1E;IAAhB,KAAK,EAAE;;qDAAmF;AAC1E;IAAhB,KAAK,EAAE;;iDAAmB;AALhB,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAqC9B","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@operato/popup/ox-popup-actions.js'\nimport '@things-factory/announcement/dist-client'\n\nimport gql from 'graphql-tag'\nimport { html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { MutationController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { CommonPopupStyles, FormFieldStyles, PopupBodyStyles, PopupFieldStyles } from '@operato/styles'\n\nimport { t } from '../utils/learning-words.js'\n\n/** Opens the assignment form of a course. Resolves with how many enrolments it holds now, or null. */\nexport function openAssignForm(course: { id: string; name: string }): Promise<number | null> {\n const popup = openPopup(html`<learning-assign-form .course=${course} @assigned=${(e: CustomEvent) => popup.close(e.detail)} @close=${() => popup.close()}></learning-assign-form>`, { backdrop: true, size: 'medium', title: t('title.learning-assign', { course: course.name }) })\n return popup.result.then(value => (value ?? null) as any)\n}\n\n/*\n * 수강 배정 (ADR-0194 decision 7) - whom a course is assigned to, by the one audience rule (the domain, departments with\n * those under them, roles and people - ADR-0163), and the day it is due. Each person gets a to-do.\n */\n@customElement('learning-assign-form')\nexport class LearningAssignForm extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormFieldStyles, PopupFieldStyles]\n\n @property({ attribute: false }) course: { id: string; name: string } = { id: '', name: '' }\n @state() private audiences: { scope: string; targetId: string; targetName?: string }[] = []\n @state() private dueOn = ''\n\n private assign = new MutationController(this, gql`mutation ($courseId: String!, $audiences: [LearningAudienceInput!]!, $dueOn: String) { assignCourse(courseId: $courseId, audiences: $audiences, dueOn: $dueOn) { id } }`, { showsError: true })\n\n render() {\n const error: any = this.assign.error\n return html`\n <div class=\"body\">\n <div class=\"field\">\n <span>${t('field.learning-assign-audience')}</span>\n <announcement-audience-picker .value=${this.audiences} @change=${(e: CustomEvent) => Array.isArray(e.detail) && (this.audiences = e.detail)}></announcement-audience-picker>\n <span>${t('text.learning-assign-audience-hint')}</span>\n </div>\n <label class=\"field\">\n <span>${t('field.learning-due-on')}</span>\n <input type=\"date\" .value=${this.dueOn} @input=${(e: any) => (this.dueOn = e.target.value)} />\n <span>${t('text.learning-due-on-hint')}</span>\n </label>\n ${error ? html`<div class=\"field\"><span invalid role=\"alert\">${error.graphQLErrors?.[0]?.message ?? error.message}</span></div>` : nothing}\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.dispatchEvent(new CustomEvent('close'))}>${t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${!this.audiences.length || this.assign.pending} @click=${() => this.submit()}>${t('button.learning-assign')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n private async submit() {\n const audiences = this.audiences.map(({ scope, targetId, targetName }) => ({ scope, targetId, targetName }))\n const done = await this.assign.run({ courseId: this.course.id, audiences, dueOn: this.dueOn || null })\n if (done) this.dispatchEvent(new CustomEvent('assigned', { detail: done.assignCourse.length }))\n }\n}\n"]}
1
+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AE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC;qDAClE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,WAAW,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,wBAAwB,CAAC;;KAE1J,CAAA;IACH,CAAC;IAEO,KAAK,CAAC,MAAM;QAClB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAA;QAC5G,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC,CAAA;QACtG,IAAI,IAAI;YAAE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IACjG,CAAC;;AAjC+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;kDAA4D;AAC1E;IAAhB,KAAK,EAAE;;qDAAmF;AAC1E;IAAhB,KAAK,EAAE;;iDAAmB;AALhB,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAqC9B","sourcesContent":["import '@operato/input/ox-input-date.js'\nimport '@material/web/button/filled-button.js'\nimport '@material/web/button/text-button.js'\nimport '@operato/popup/ox-popup-actions.js'\nimport '@things-factory/announcement/dist-client'\n\nimport gql from 'graphql-tag'\nimport { html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { MutationController } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { openPopup } from '@operato/layout'\nimport { CommonPopupStyles, FormFieldStyles, PopupBodyStyles, PopupFieldStyles } from '@operato/styles'\n\nimport { t } from '../utils/learning-words.js'\n\n/** Opens the assignment form of a course. Resolves with how many enrolments it holds now, or null. */\nexport function openAssignForm(course: { id: string; name: string }): Promise<number | null> {\n const popup = openPopup(html`<learning-assign-form .course=${course} @assigned=${(e: CustomEvent) => popup.close(e.detail)} @close=${() => popup.close()}></learning-assign-form>`, { backdrop: true, size: 'medium', title: t('title.learning-assign', { course: course.name }) })\n return popup.result.then(value => (value ?? null) as any)\n}\n\n/*\n * 수강 배정 (ADR-0194 decision 7) - whom a course is assigned to, by the one audience rule (the domain, departments with\n * those under them, roles and people - ADR-0163), and the day it is due. Each person gets a to-do.\n */\n@customElement('learning-assign-form')\nexport class LearningAssignForm extends localize(i18next)(LitElement) {\n static styles = [CommonPopupStyles, PopupBodyStyles, FormFieldStyles, PopupFieldStyles]\n\n @property({ attribute: false }) course: { id: string; name: string } = { id: '', name: '' }\n @state() private audiences: { scope: string; targetId: string; targetName?: string }[] = []\n @state() private dueOn = ''\n\n private assign = new MutationController(this, gql`mutation ($courseId: String!, $audiences: [LearningAudienceInput!]!, $dueOn: String) { assignCourse(courseId: $courseId, audiences: $audiences, dueOn: $dueOn) { id } }`, { showsError: true })\n\n render() {\n const error: any = this.assign.error\n return html`\n <div class=\"body\">\n <div class=\"field\">\n <span>${t('field.learning-assign-audience')}</span>\n <announcement-audience-picker .value=${this.audiences} @change=${(e: CustomEvent) => Array.isArray(e.detail) && (this.audiences = e.detail)}></announcement-audience-picker>\n <span>${t('text.learning-assign-audience-hint')}</span>\n </div>\n <label class=\"field\">\n <span>${t('field.learning-due-on')}</span>\n <ox-input-date type=\"date\" .value=${this.dueOn} @change=${(e: any) => (this.dueOn = e.target.value)}></ox-input-date>\n <span>${t('text.learning-due-on-hint')}</span>\n </label>\n ${error ? html`<div class=\"field\"><span invalid role=\"alert\">${error.graphQLErrors?.[0]?.message ?? error.message}</span></div>` : nothing}\n </div>\n <ox-popup-actions>\n <md-text-button slot=\"cancel\" @click=${() => this.dispatchEvent(new CustomEvent('close'))}>${t('button.cancel')}</md-text-button>\n <md-filled-button slot=\"confirm\" ?disabled=${!this.audiences.length || this.assign.pending} @click=${() => this.submit()}>${t('button.learning-assign')}</md-filled-button>\n </ox-popup-actions>\n `\n }\n\n private async submit() {\n const audiences = this.audiences.map(({ scope, targetId, targetName }) => ({ scope, targetId, targetName }))\n const done = await this.assign.run({ courseId: this.course.id, audiences, dueOn: this.dueOn || null })\n if (done) this.dispatchEvent(new CustomEvent('assigned', { detail: done.assignCourse.length }))\n }\n}\n"]}