change export
parent
b8c61fe15e
commit
b4c610f9be
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Contract;
|
||||
|
||||
class BuyContractsSheet extends ContractsSheet
|
||||
{
|
||||
|
||||
public function query()
|
||||
{
|
||||
return Contract::buyContracts()->whereYear('date', '=', $this->year)->orderBy('date', 'asc');
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
['Ankaufsverträge ' . $this->year],
|
||||
[
|
||||
'Datum',
|
||||
'Auto',
|
||||
'Stammnummer',
|
||||
'Verkäufer',
|
||||
'Betrag',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function map($contract): array
|
||||
{
|
||||
return [
|
||||
$contract->date_formatted,
|
||||
$contract->car->name,
|
||||
$contract->car->stammnummer,
|
||||
$contract->contact->full_title,
|
||||
$contract->price,
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'Ankaufsverträge';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
class ContractsExport implements WithMultipleSheets
|
||||
{
|
||||
protected $year;
|
||||
|
||||
public function __construct(int $year)
|
||||
{
|
||||
$this->year = $year;
|
||||
}
|
||||
|
||||
public function sheets(): array
|
||||
{
|
||||
$sheets = [];
|
||||
|
||||
$sheets[] = new ContractsSheet($this->year);
|
||||
$sheets[] = new BuyContractsSheet($this->year);
|
||||
$sheets[] = new SellContractsSheet($this->year);
|
||||
|
||||
return $sheets;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Contract;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
use Maatwebsite\Excel\Concerns\RegistersEventListeners;
|
||||
|
||||
class ContractsSheet implements FromQuery, WithTitle, WithHeadings, WithMapping, WithStyles, WithEvents
|
||||
{
|
||||
use RegistersEventListeners;
|
||||
protected $year;
|
||||
|
||||
public function __construct(int $year)
|
||||
{
|
||||
$this->year = $year;
|
||||
}
|
||||
|
||||
public function query()
|
||||
{
|
||||
return Contract::whereYear('date', '=', $this->year)->orderBy('date', 'asc');
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
['Alle Verträge ' . $this->year],
|
||||
[
|
||||
'Datum',
|
||||
'Vertragsart',
|
||||
'Auto',
|
||||
'Stammnummer',
|
||||
'Kontakt',
|
||||
'Betrag',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function map($contract): array
|
||||
{
|
||||
return [
|
||||
$contract->date_formatted,
|
||||
$contract->type_formatted,
|
||||
$contract->car->name,
|
||||
$contract->car->stammnummer,
|
||||
$contract->contact->full_title,
|
||||
$contract->price,
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'Alle Verträge';
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet)
|
||||
{
|
||||
return [
|
||||
1 => ['font' => ['bold' => true]],
|
||||
2 => ['font' => ['bold' => true]],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Car;
|
||||
use App\Models\Contract;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
class Report implements FromCollection ,WithTitle, WithHeadings, WithStyles, WithColumnFormatting, ShouldAutoSize
|
||||
{
|
||||
protected $year;
|
||||
|
||||
public function __construct(int $year)
|
||||
{
|
||||
$this->year = $year;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Bezeichnung',
|
||||
'Stammnummer',
|
||||
'Einkaufsdatum',
|
||||
'Einkaufpreis',
|
||||
'Verkäufer',
|
||||
'Verkaufsdatum',
|
||||
'Verkaufspreis',
|
||||
'Käufer',
|
||||
'Lagerbestand',
|
||||
];
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$cars = Contract::with('car')->soldByYear($this->year)->get()->pluck('car');
|
||||
$cars = $cars->merge(Car::unsoldOnly()->get())->unique()->map(function ($car) {
|
||||
$bcontract = $car->latestBuyContract();
|
||||
$scontract = $car->latestSellContract();
|
||||
if (!$car->isSold()) {
|
||||
$scontract = null;
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => $car->name_with_year,
|
||||
'stammnummer' => $car->stammnummer,
|
||||
'buy_date' => $bcontract ? Date::dateTimeToExcel(Carbon::parse($bcontract->date)) : null,
|
||||
'buy_price' => $bcontract ? $bcontract->price_for_excel : null,
|
||||
'seller' => $bcontract ? $bcontract->contact->full_title_with_address : null,
|
||||
'sell_date' => $scontract ? Date::dateTimeToExcel(Carbon::parse($scontract->date)) : null,
|
||||
'sell_price' => $scontract ? $scontract->price_for_excel : null,
|
||||
'buyer' => $scontract ? $scontract->contact->full_title_with_address : null,
|
||||
'lager' => !$scontract && $bcontract ? $bcontract->price_for_excel : null,
|
||||
];
|
||||
})->sortBy('buy_date');
|
||||
|
||||
return $cars;
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet)
|
||||
{
|
||||
return [
|
||||
1 => ['font' => ['bold' => true]],
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'C' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
||||
'D' => NumberFormat::FORMAT_NUMBER_00,
|
||||
'F' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
||||
'G' => NumberFormat::FORMAT_NUMBER_00,
|
||||
'I' => NumberFormat::FORMAT_NUMBER_00,
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'Wagenhandelbuch ' . $this->year;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Contract;
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
|
||||
class SellContractsSheet extends ContractsSheet
|
||||
{
|
||||
|
||||
public function query()
|
||||
{
|
||||
return Contract::sellContracts()->whereYear('date', '=', $this->year)->orderBy('date', 'asc');
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
['Verkaufsverträge ' . $this->year],
|
||||
[
|
||||
'Datum',
|
||||
'Auto',
|
||||
'Stammnummer',
|
||||
'Käufer',
|
||||
'Versicherung',
|
||||
'Betrag',
|
||||
'Eingezahlt',
|
||||
'Noch offen'
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function map($contract): array
|
||||
{
|
||||
return [
|
||||
$contract->date_formatted,
|
||||
$contract->car->name,
|
||||
$contract->car->stammnummer,
|
||||
$contract->contact->full_title,
|
||||
$contract->insurance_type_formatted,
|
||||
$contract->price,
|
||||
$contract->paid,
|
||||
$contract->left_to_pay,
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'Verkaufsverträge';
|
||||
}
|
||||
}
|
||||
|
|
@ -3,10 +3,8 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Inertia\Inertia;
|
||||
use App\Models\Contract;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Exports\ContractsExport;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use App\Exports\Report;
|
||||
use Maatwebsite\Excel\Facades\Excel as Excel;
|
||||
|
||||
class ReportController extends Controller
|
||||
|
|
@ -19,6 +17,6 @@ class ReportController extends Controller
|
|||
public function print(Request $request)
|
||||
{
|
||||
$year = (int)$request->get('year');
|
||||
return Excel::download(new ContractsExport($year), 'Jahresbericht-' . $year .'.xlsx');
|
||||
return Excel::download(new Report($year), 'Wagenhandelbuch-' . $year .'.xlsx');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class Car extends Model
|
|||
|
||||
public function isSold()
|
||||
{
|
||||
return $this->buyContracts()->count() >= 1 && $this->buyContracts()->count() <= $this->sellContracts()->count();
|
||||
return $this->buyContracts()->count() <= $this->sellContracts()->count();
|
||||
}
|
||||
|
||||
public function contracts()
|
||||
|
|
|
|||
|
|
@ -63,6 +63,12 @@ class Contact extends Model
|
|||
return implode(', ', array_filter([$this->company, $this->name]));
|
||||
}
|
||||
|
||||
|
||||
public function getFullTitleWithAddressAttribute()
|
||||
{
|
||||
return implode(', ', array_filter([$this->full_title, $this->address, $this->full_city]));
|
||||
}
|
||||
|
||||
public function getFullCityAttribute()
|
||||
{
|
||||
return $this->zip . ' ' . $this->city;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ class Contract extends Model
|
|||
return Money::CHF($price);
|
||||
}
|
||||
|
||||
public function getPriceForExcelAttribute()
|
||||
{
|
||||
return $this->price->format(null, null, 0);
|
||||
}
|
||||
|
||||
public function getPaidAttribute()
|
||||
{
|
||||
|
||||
|
|
@ -129,6 +134,11 @@ class Contract extends Model
|
|||
$query->sellContracts()->thisYear();
|
||||
}
|
||||
|
||||
public function scopeSoldByYear($query, $year)
|
||||
{
|
||||
$query->sellContracts()->whereYear('date', $year);
|
||||
}
|
||||
|
||||
public function scopeBoughtThisYear($query)
|
||||
{
|
||||
$query->buyContracts()->thisYear();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*! tailwindcss v2.2.2 | MIT License | https://tailwindcss.com */
|
||||
/*! tailwindcss v2.2.4 | MIT License | https://tailwindcss.com */
|
||||
|
||||
/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
||||
|
||||
|
|
@ -332,16 +332,6 @@ button {
|
|||
background-image: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Work around a Firefox/IE bug where the transparent `button` background
|
||||
* results in a loss of the default `button` focus styles.
|
||||
*/
|
||||
|
||||
button:focus {
|
||||
outline: 1px dotted;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
|
|
|||
|
|
@ -502,18 +502,59 @@ function isCoreComponent(tag) {
|
|||
}
|
||||
const nonIdentifierRE = /^\d|[^\$\w]/;
|
||||
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
||||
const memberExpRE = /^[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*(?:\s*\.\s*[A-Za-z_$\xA0-\uFFFF][\w$\xA0-\uFFFF]*|\[(.+)\])*$/;
|
||||
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
||||
const validIdentCharRE = /[\.\w$\xA0-\uFFFF]/;
|
||||
const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
|
||||
/**
|
||||
* Simple lexer to check if an expression is a member expression. This is
|
||||
* lax and only checks validity at the root level (i.e. does not validate exps
|
||||
* inside square brackets), but it's ok since these are only used on template
|
||||
* expressions and false positives are invalid expressions in the first place.
|
||||
*/
|
||||
const isMemberExpression = (path) => {
|
||||
if (!path)
|
||||
return false;
|
||||
const matched = memberExpRE.exec(path.trim());
|
||||
if (!matched)
|
||||
return false;
|
||||
if (!matched[1])
|
||||
return true;
|
||||
if (!/[\[\]]/.test(matched[1]))
|
||||
return true;
|
||||
return isMemberExpression(matched[1].trim());
|
||||
// remove whitespaces around . or [ first
|
||||
path = path.trim().replace(whitespaceRE, s => s.trim());
|
||||
let state = 0 /* inMemberExp */;
|
||||
let prevState = 0 /* inMemberExp */;
|
||||
let currentOpenBracketCount = 0;
|
||||
let currentStringType = null;
|
||||
for (let i = 0; i < path.length; i++) {
|
||||
const char = path.charAt(i);
|
||||
switch (state) {
|
||||
case 0 /* inMemberExp */:
|
||||
if (char === '[') {
|
||||
prevState = state;
|
||||
state = 1 /* inBrackets */;
|
||||
currentOpenBracketCount++;
|
||||
}
|
||||
else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 1 /* inBrackets */:
|
||||
if (char === `'` || char === `"` || char === '`') {
|
||||
prevState = state;
|
||||
state = 2 /* inString */;
|
||||
currentStringType = char;
|
||||
}
|
||||
else if (char === `[`) {
|
||||
currentOpenBracketCount++;
|
||||
}
|
||||
else if (char === `]`) {
|
||||
if (!--currentOpenBracketCount) {
|
||||
state = prevState;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2 /* inString */:
|
||||
if (char === currentStringType) {
|
||||
state = prevState;
|
||||
currentStringType = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return !currentOpenBracketCount;
|
||||
};
|
||||
function getInnerRange(loc, offset, length) {
|
||||
const source = loc.source.substr(offset, length);
|
||||
|
|
@ -1194,41 +1235,17 @@ function parseTag(context, type, parent) {
|
|||
}
|
||||
}
|
||||
let tagType = 0 /* ELEMENT */;
|
||||
const options = context.options;
|
||||
if (!context.inVPre && !options.isCustomElement(tag)) {
|
||||
const hasVIs = props.some(p => {
|
||||
if (p.name !== 'is')
|
||||
return;
|
||||
// v-is="xxx" (TODO: deprecate)
|
||||
if (p.type === 7 /* DIRECTIVE */) {
|
||||
return true;
|
||||
}
|
||||
// is="vue:xxx"
|
||||
if (p.value && p.value.content.startsWith('vue:')) {
|
||||
return true;
|
||||
}
|
||||
// in compat mode, any is usage is considered a component
|
||||
if (checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (options.isNativeTag && !hasVIs) {
|
||||
if (!options.isNativeTag(tag))
|
||||
tagType = 1 /* COMPONENT */;
|
||||
}
|
||||
else if (hasVIs ||
|
||||
isCoreComponent(tag) ||
|
||||
(options.isBuiltInComponent && options.isBuiltInComponent(tag)) ||
|
||||
/^[A-Z]/.test(tag) ||
|
||||
tag === 'component') {
|
||||
tagType = 1 /* COMPONENT */;
|
||||
}
|
||||
if (!context.inVPre) {
|
||||
if (tag === 'slot') {
|
||||
tagType = 2 /* SLOT */;
|
||||
}
|
||||
else if (tag === 'template' &&
|
||||
props.some(p => p.type === 7 /* DIRECTIVE */ && isSpecialTemplateDirective(p.name))) {
|
||||
tagType = 3 /* TEMPLATE */;
|
||||
else if (tag === 'template') {
|
||||
if (props.some(p => p.type === 7 /* DIRECTIVE */ && isSpecialTemplateDirective(p.name))) {
|
||||
tagType = 3 /* TEMPLATE */;
|
||||
}
|
||||
}
|
||||
else if (isComponent(tag, props, context)) {
|
||||
tagType = 1 /* COMPONENT */;
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
|
@ -1243,6 +1260,49 @@ function parseTag(context, type, parent) {
|
|||
codegenNode: undefined // to be created during transform phase
|
||||
};
|
||||
}
|
||||
function isComponent(tag, props, context) {
|
||||
const options = context.options;
|
||||
if (options.isCustomElement(tag)) {
|
||||
return false;
|
||||
}
|
||||
if (tag === 'component' ||
|
||||
/^[A-Z]/.test(tag) ||
|
||||
isCoreComponent(tag) ||
|
||||
(options.isBuiltInComponent && options.isBuiltInComponent(tag)) ||
|
||||
(options.isNativeTag && !options.isNativeTag(tag))) {
|
||||
return true;
|
||||
}
|
||||
// at this point the tag should be a native tag, but check for potential "is"
|
||||
// casting
|
||||
for (let i = 0; i < props.length; i++) {
|
||||
const p = props[i];
|
||||
if (p.type === 6 /* ATTRIBUTE */) {
|
||||
if (p.name === 'is' && p.value) {
|
||||
if (p.value.content.startsWith('vue:')) {
|
||||
return true;
|
||||
}
|
||||
else if (checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// directive
|
||||
// v-is (TODO Deprecate)
|
||||
if (p.name === 'is') {
|
||||
return true;
|
||||
}
|
||||
else if (
|
||||
// :is on plain element - only treat as component in compat mode
|
||||
p.name === 'bind' &&
|
||||
isBindKey(p.arg, 'is') &&
|
||||
true &&
|
||||
checkCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context, p.loc)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function parseAttributes(context, type) {
|
||||
const props = [];
|
||||
const attributeNames = new Set();
|
||||
|
|
@ -3564,16 +3624,10 @@ function resolveComponentType(node, context, ssr = false) {
|
|||
let { tag } = node;
|
||||
// 1. dynamic component
|
||||
const isExplicitDynamic = isComponentTag(tag);
|
||||
const isProp = findProp(node, 'is') || (!isExplicitDynamic && findDir(node, 'is'));
|
||||
const isProp = findProp(node, 'is');
|
||||
if (isProp) {
|
||||
if (!isExplicitDynamic && isProp.type === 6 /* ATTRIBUTE */) {
|
||||
// <button is="vue:xxx">
|
||||
// if not <component>, only is value that starts with "vue:" will be
|
||||
// treated as component by the parse phase and reach here, unless it's
|
||||
// compat mode where all is values are considered components
|
||||
tag = isProp.value.content.replace(/^vue:/, '');
|
||||
}
|
||||
else {
|
||||
if (isExplicitDynamic ||
|
||||
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))) {
|
||||
const exp = isProp.type === 6 /* ATTRIBUTE */
|
||||
? isProp.value && createSimpleExpression(isProp.value.content, true)
|
||||
: isProp.exp;
|
||||
|
|
@ -3583,6 +3637,21 @@ function resolveComponentType(node, context, ssr = false) {
|
|||
]);
|
||||
}
|
||||
}
|
||||
else if (isProp.type === 6 /* ATTRIBUTE */ &&
|
||||
isProp.value.content.startsWith('vue:')) {
|
||||
// <button is="vue:xxx">
|
||||
// if not <component>, only is value that starts with "vue:" will be
|
||||
// treated as component by the parse phase and reach here, unless it's
|
||||
// compat mode where all is values are considered components
|
||||
tag = isProp.value.content.slice(4);
|
||||
}
|
||||
}
|
||||
// 1.5 v-is (TODO: Deprecate)
|
||||
const isDir = !isExplicitDynamic && findDir(node, 'is');
|
||||
if (isDir && isDir.exp) {
|
||||
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
||||
isDir.exp
|
||||
]);
|
||||
}
|
||||
// 2. built-in components (Teleport, Transition, KeepAlive, Suspense...)
|
||||
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
||||
|
|
@ -3666,7 +3735,9 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|||
}
|
||||
// skip is on <component>, or is="vue:xxx"
|
||||
if (name === 'is' &&
|
||||
(isComponentTag(tag) || (value && value.content.startsWith('vue:')))) {
|
||||
(isComponentTag(tag) ||
|
||||
(value && value.content.startsWith('vue:')) ||
|
||||
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context)))) {
|
||||
continue;
|
||||
}
|
||||
properties.push(createObjectProperty(createSimpleExpression(name, true, getInnerRange(loc, 0, name.length)), createSimpleExpression(value ? value.content : '', isStatic, value ? value.loc : loc)));
|
||||
|
|
@ -3689,7 +3760,10 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|||
}
|
||||
// skip v-is and :is on <component>
|
||||
if (name === 'is' ||
|
||||
(isVBind && isComponentTag(tag) && isBindKey(arg, 'is'))) {
|
||||
(isVBind &&
|
||||
isBindKey(arg, 'is') &&
|
||||
(isComponentTag(tag) ||
|
||||
(isCompatEnabled("COMPILER_IS_ON_ELEMENT" /* COMPILER_IS_ON_ELEMENT */, context))))) {
|
||||
continue;
|
||||
}
|
||||
// skip v-on in SSR compilation
|
||||
|
|
@ -4233,7 +4307,7 @@ const transformModel = (dir, node, context) => {
|
|||
// _unref(exp)
|
||||
context.bindingMetadata[rawExp];
|
||||
const maybeRef = !true /* SETUP_CONST */;
|
||||
if (!isMemberExpression(expString) && !maybeRef) {
|
||||
if (!expString.trim() || (!isMemberExpression(expString) && !maybeRef)) {
|
||||
context.onError(createCompilerError(41 /* X_V_MODEL_MALFORMED_EXPRESSION */, exp.loc));
|
||||
return createTransformProps();
|
||||
}
|
||||
|
|
@ -6079,7 +6153,7 @@ function shallowRef(value) {
|
|||
return createRef(value, true);
|
||||
}
|
||||
class RefImpl {
|
||||
constructor(_rawValue, _shallow = false) {
|
||||
constructor(_rawValue, _shallow) {
|
||||
this._rawValue = _rawValue;
|
||||
this._shallow = _shallow;
|
||||
this.__v_isRef = true;
|
||||
|
|
@ -7328,11 +7402,12 @@ function emit(instance, event, ...rawArgs) {
|
|||
const onceHandler = props[handlerName + `Once`];
|
||||
if (onceHandler) {
|
||||
if (!instance.emitted) {
|
||||
(instance.emitted = {})[handlerName] = true;
|
||||
instance.emitted = {};
|
||||
}
|
||||
else if (instance.emitted[handlerName]) {
|
||||
return;
|
||||
}
|
||||
instance.emitted[handlerName] = true;
|
||||
callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -7799,6 +7874,12 @@ const SuspenseImpl = {
|
|||
// Force-casted public typing for h and TSX props inference
|
||||
const Suspense = (SuspenseImpl
|
||||
);
|
||||
function triggerEvent(vnode, name) {
|
||||
const eventListener = vnode.props && vnode.props[name];
|
||||
if ((0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.isFunction)(eventListener)) {
|
||||
eventListener();
|
||||
}
|
||||
}
|
||||
function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, rendererInternals) {
|
||||
const { p: patch, o: { createElement } } = rendererInternals;
|
||||
const hiddenContainer = createElement('div');
|
||||
|
|
@ -7808,6 +7889,9 @@ function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense
|
|||
// now check if we have encountered any async deps
|
||||
if (suspense.deps > 0) {
|
||||
// has async
|
||||
// invoke @fallback event
|
||||
triggerEvent(vnode, 'onPending');
|
||||
triggerEvent(vnode, 'onFallback');
|
||||
// mount the fallback tree
|
||||
patch(null, vnode.ssFallback, container, anchor, parentComponent, null, // fallback tree will not have suspense context
|
||||
isSVG, slotScopeIds);
|
||||
|
|
@ -7895,10 +7979,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG, slotSc
|
|||
else {
|
||||
// root node toggled
|
||||
// invoke @pending event
|
||||
const onPending = n2.props && n2.props.onPending;
|
||||
if ((0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.isFunction)(onPending)) {
|
||||
onPending();
|
||||
}
|
||||
triggerEvent(n2, 'onPending');
|
||||
// mount pending branch in off-dom container
|
||||
suspense.pendingBranch = newBranch;
|
||||
suspense.pendingId++;
|
||||
|
|
@ -8011,10 +8092,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|||
}
|
||||
suspense.effects = [];
|
||||
// invoke @resolve event
|
||||
const onResolve = vnode.props && vnode.props.onResolve;
|
||||
if ((0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.isFunction)(onResolve)) {
|
||||
onResolve();
|
||||
}
|
||||
triggerEvent(vnode, 'onResolve');
|
||||
},
|
||||
fallback(fallbackVNode) {
|
||||
if (!suspense.pendingBranch) {
|
||||
|
|
@ -8022,10 +8100,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|||
}
|
||||
const { vnode, activeBranch, parentComponent, container, isSVG } = suspense;
|
||||
// invoke @fallback event
|
||||
const onFallback = vnode.props && vnode.props.onFallback;
|
||||
if ((0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.isFunction)(onFallback)) {
|
||||
onFallback();
|
||||
}
|
||||
triggerEvent(vnode, 'onFallback');
|
||||
const anchor = next(activeBranch);
|
||||
const mountFallback = () => {
|
||||
if (!suspense.isInFallback) {
|
||||
|
|
@ -8040,11 +8115,11 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|||
if (delayEnter) {
|
||||
activeBranch.transition.afterLeave = mountFallback;
|
||||
}
|
||||
suspense.isInFallback = true;
|
||||
// unmount current active branch
|
||||
unmount(activeBranch, parentComponent, null, // no suspense so unmount hooks fire now
|
||||
true // shouldRemove
|
||||
);
|
||||
suspense.isInFallback = true;
|
||||
if (!delayEnter) {
|
||||
mountFallback();
|
||||
}
|
||||
|
|
@ -8239,7 +8314,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|||
}
|
||||
else if (arguments.length > 1) {
|
||||
return treatDefaultAsFactory && (0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.isFunction)(defaultValue)
|
||||
? defaultValue()
|
||||
? defaultValue.call(instance.proxy)
|
||||
: defaultValue;
|
||||
}
|
||||
else if ((true)) {
|
||||
|
|
@ -9601,25 +9676,23 @@ const internalOptionMergeStrats = {
|
|||
methods: mergeObjectOptions,
|
||||
computed: mergeObjectOptions,
|
||||
// lifecycle
|
||||
beforeCreate: mergeHook,
|
||||
created: mergeHook,
|
||||
beforeMount: mergeHook,
|
||||
mounted: mergeHook,
|
||||
beforeUpdate: mergeHook,
|
||||
updated: mergeHook,
|
||||
beforeDestroy: mergeHook,
|
||||
destroyed: mergeHook,
|
||||
activated: mergeHook,
|
||||
deactivated: mergeHook,
|
||||
errorCaptured: mergeHook,
|
||||
serverPrefetch: mergeHook,
|
||||
beforeCreate: mergeAsArray,
|
||||
created: mergeAsArray,
|
||||
beforeMount: mergeAsArray,
|
||||
mounted: mergeAsArray,
|
||||
beforeUpdate: mergeAsArray,
|
||||
updated: mergeAsArray,
|
||||
beforeDestroy: mergeAsArray,
|
||||
destroyed: mergeAsArray,
|
||||
activated: mergeAsArray,
|
||||
deactivated: mergeAsArray,
|
||||
errorCaptured: mergeAsArray,
|
||||
serverPrefetch: mergeAsArray,
|
||||
// assets
|
||||
components: mergeObjectOptions,
|
||||
directives: mergeObjectOptions,
|
||||
// watch has special merge behavior in v2, but isn't actually needed in v3.
|
||||
// since we are only exposing these for compat and nobody should be relying
|
||||
// on the watch-specific behavior, just expose the object merge strat.
|
||||
watch: mergeObjectOptions,
|
||||
// watch
|
||||
watch: mergeWatchOptions,
|
||||
// provide / inject
|
||||
provide: mergeDataFn,
|
||||
inject: mergeInject
|
||||
|
|
@ -9648,12 +9721,23 @@ function normalizeInject(raw) {
|
|||
}
|
||||
return raw;
|
||||
}
|
||||
function mergeHook(to, from) {
|
||||
function mergeAsArray(to, from) {
|
||||
return to ? [...new Set([].concat(to, from))] : from;
|
||||
}
|
||||
function mergeObjectOptions(to, from) {
|
||||
return to ? (0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.extend)((0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.extend)(Object.create(null), to), from) : from;
|
||||
}
|
||||
function mergeWatchOptions(to, from) {
|
||||
if (!to)
|
||||
return from;
|
||||
if (!from)
|
||||
return to;
|
||||
const merged = (0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.extend)(Object.create(null), to);
|
||||
for (const key in from) {
|
||||
merged[key] = mergeAsArray(to[key], from[key]);
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
||||
function initProps(instance, rawProps, isStateful, // result of bitwise flag comparison
|
||||
isSSR = false) {
|
||||
|
|
@ -10311,6 +10395,7 @@ function createAppAPI(render, hydrate) {
|
|||
_props: rootProps,
|
||||
_container: null,
|
||||
_context: context,
|
||||
_instance: null,
|
||||
version,
|
||||
get config() {
|
||||
return context.config;
|
||||
|
|
@ -10401,6 +10486,7 @@ function createAppAPI(render, hydrate) {
|
|||
app._container = rootContainer;
|
||||
rootContainer.__vue_app__ = app;
|
||||
if (true) {
|
||||
app._instance = vnode.component;
|
||||
devtoolsInitApp(app, version);
|
||||
}
|
||||
return vnode.component.proxy;
|
||||
|
|
@ -10416,6 +10502,7 @@ function createAppAPI(render, hydrate) {
|
|||
if (isMounted) {
|
||||
render(null, app._container);
|
||||
if (true) {
|
||||
app._instance = null;
|
||||
devtoolsUnmountApp(app);
|
||||
}
|
||||
delete app._container.__vue_app__;
|
||||
|
|
@ -11023,7 +11110,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|||
}
|
||||
};
|
||||
const mountStaticNode = (n2, container, anchor, isSVG) => {
|
||||
[n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG);
|
||||
[n2.el, n2.anchor] = hostInsertStaticContent(n2.children, container, anchor, isSVG,
|
||||
// pass cached nodes if the static node is being mounted multiple times
|
||||
// so that runtime-dom can simply cloneNode() instead of inserting new
|
||||
// HTML
|
||||
n2.el && [n2.el, n2.anchor]);
|
||||
};
|
||||
/**
|
||||
* Dev / HMR only
|
||||
|
|
@ -13062,10 +13153,6 @@ const publicPropertiesMap = (0,_vue_shared__WEBPACK_IMPORTED_MODULE_1__.extend)(
|
|||
const PublicInstanceProxyHandlers = {
|
||||
get({ _: instance }, key) {
|
||||
const { ctx, setupState, data, props, accessCache, type, appContext } = instance;
|
||||
// let @vue/reactivity know it should never observe Vue public instances.
|
||||
if (key === "__v_skip" /* SKIP */) {
|
||||
return true;
|
||||
}
|
||||
// for internal formatters to know that this is a Vue instance
|
||||
if (( true) && key === '__isVue') {
|
||||
return true;
|
||||
|
|
@ -13421,7 +13508,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|||
instance.accessCache = Object.create(null);
|
||||
// 1. create public instance / render proxy
|
||||
// also mark it raw so it's never observed
|
||||
instance.proxy = new Proxy(instance.ctx, PublicInstanceProxyHandlers);
|
||||
instance.proxy = (0,_vue_reactivity__WEBPACK_IMPORTED_MODULE_0__.markRaw)(new Proxy(instance.ctx, PublicInstanceProxyHandlers));
|
||||
if ((true)) {
|
||||
exposePropsOnRenderContext(instance);
|
||||
}
|
||||
|
|
@ -13896,7 +13983,7 @@ function initCustomFormatter() {
|
|||
}
|
||||
|
||||
// Core API ------------------------------------------------------------------
|
||||
const version = "3.1.1";
|
||||
const version = "3.1.2";
|
||||
/**
|
||||
* SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
|
||||
* @internal
|
||||
|
|
@ -14051,8 +14138,6 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
const svgNS = 'http://www.w3.org/2000/svg';
|
||||
const doc = (typeof document !== 'undefined' ? document : null);
|
||||
let tempContainer;
|
||||
let tempSVGContainer;
|
||||
const nodeOps = {
|
||||
insert: (child, parent, anchor) => {
|
||||
parent.insertBefore(child, anchor || null);
|
||||
|
|
@ -14103,24 +14188,57 @@ const nodeOps = {
|
|||
return cloned;
|
||||
},
|
||||
// __UNSAFE__
|
||||
// Reason: innerHTML.
|
||||
// Reason: insertAdjacentHTML.
|
||||
// Static content here can only come from compiled templates.
|
||||
// As long as the user only uses trusted templates, this is safe.
|
||||
insertStaticContent(content, parent, anchor, isSVG) {
|
||||
const temp = isSVG
|
||||
? tempSVGContainer ||
|
||||
(tempSVGContainer = doc.createElementNS(svgNS, 'svg'))
|
||||
: tempContainer || (tempContainer = doc.createElement('div'));
|
||||
temp.innerHTML = content;
|
||||
const first = temp.firstChild;
|
||||
let node = first;
|
||||
let last = node;
|
||||
while (node) {
|
||||
last = node;
|
||||
nodeOps.insert(node, parent, anchor);
|
||||
node = temp.firstChild;
|
||||
insertStaticContent(content, parent, anchor, isSVG, cached) {
|
||||
if (cached) {
|
||||
let [cachedFirst, cachedLast] = cached;
|
||||
let first, last;
|
||||
while (true) {
|
||||
let node = cachedFirst.cloneNode(true);
|
||||
if (!first)
|
||||
first = node;
|
||||
parent.insertBefore(node, anchor);
|
||||
if (cachedFirst === cachedLast) {
|
||||
last = node;
|
||||
break;
|
||||
}
|
||||
cachedFirst = cachedFirst.nextSibling;
|
||||
}
|
||||
return [first, last];
|
||||
}
|
||||
return [first, last];
|
||||
// <parent> before | first ... last | anchor </parent>
|
||||
const before = anchor ? anchor.previousSibling : parent.lastChild;
|
||||
if (anchor) {
|
||||
let insertionPoint;
|
||||
let usingTempInsertionPoint = false;
|
||||
if (anchor instanceof Element) {
|
||||
insertionPoint = anchor;
|
||||
}
|
||||
else {
|
||||
// insertAdjacentHTML only works for elements but the anchor is not an
|
||||
// element...
|
||||
usingTempInsertionPoint = true;
|
||||
insertionPoint = isSVG
|
||||
? doc.createElementNS(svgNS, 'g')
|
||||
: doc.createElement('div');
|
||||
parent.insertBefore(insertionPoint, anchor);
|
||||
}
|
||||
insertionPoint.insertAdjacentHTML('beforebegin', content);
|
||||
if (usingTempInsertionPoint) {
|
||||
parent.removeChild(insertionPoint);
|
||||
}
|
||||
}
|
||||
else {
|
||||
parent.insertAdjacentHTML('beforeend', content);
|
||||
}
|
||||
return [
|
||||
// first
|
||||
before ? before.nextSibling : parent.firstChild,
|
||||
// last
|
||||
anchor ? anchor.previousSibling : parent.lastChild
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -18518,7 +18636,6 @@ var STATUS_FAILED = 2;
|
|||
|
||||
// upload data to the server
|
||||
this.currentStatus = STATUS_SAVING;
|
||||
console.log(this.route('documents.store'));
|
||||
axios.post(this.route('documents.store'), formData).then(function (response) {
|
||||
_this.documents.push(response.data);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ export default {
|
|||
save(formData) {
|
||||
// upload data to the server
|
||||
this.currentStatus = STATUS_SAVING;
|
||||
console.log(this.route('documents.store'));
|
||||
axios.post(this.route('documents.store'), formData)
|
||||
.then((response) => {
|
||||
this.documents.push(response.data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue